File

src/app/@theme/components/auth/auth.component.ts

Implements

OnDestroy

Metadata

selector ngx-auth
styleUrls auth.component.scss
template
<nb-layout>
  <nb-layout-column>
    <nb-card>
      <nb-card-body>
        <div class="flex-centered col-xl-4 col-lg-6 col-md-8 col-sm-12">
          <router-outlet></router-outlet>
        </div>
      </nb-card-body>
    </nb-card>
  </nb-layout-column>
</nb-layout>

Index

Properties
Methods

Constructor

constructor()

Methods

ngOnDestroy
ngOnDestroy()
Returns : void

Properties

Private alive
alive:
Default value : true
authenticated
authenticated: boolean
Type : boolean
Default value : false
subscription
subscription: any
Type : any
token
token: string
Type : string
Default value : ''
import {Component, OnDestroy} from '@angular/core';
import {takeWhile} from 'rxjs/operators';
// import {NbAuthService} from '@nebular/auth';

@Component({
  selector: 'ngx-auth',
  styleUrls: ['./auth.component.scss'],
  template: `
    <nb-layout>
      <nb-layout-column>
        <nb-card>
          <nb-card-body>
            <div class="flex-centered col-xl-4 col-lg-6 col-md-8 col-sm-12">
              <router-outlet></router-outlet>
            </div>
          </nb-card-body>
        </nb-card>
      </nb-layout-column>
    </nb-layout>
  `,
})
export class NgxAuthComponent implements OnDestroy {

  private alive = true;

  subscription: any;

  authenticated: boolean = false;
  token: string = '';

  // showcase of how to use the onAuthenticationChange method
  constructor() {

    // this.subscription = auth.onAuthenticationChange()
    //   .pipe(takeWhile(() => this.alive))
    //   .subscribe((authenticated: boolean) => {
    //     this.authenticated = authenticated;
    //   });
  }

  ngOnDestroy(): void {
    this.alive = false;
  }
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""