File

src/app/app.component.ts

Metadata

providers { provide: TooltipConfig, useFactory: (): TooltipConfig => Object.assign(new TooltipConfig(), { container: }) }
selector cd-root
styleUrls ./app.component.scss
templateUrl ./app.component.html

Index

Properties
Methods

Constructor

constructor(authStorageService: AuthStorageService, router: Router, toastr: ToastsManager, vcr: ViewContainerRef)
Parameters :
Name Type Optional
authStorageService AuthStorageService No
router Router No
toastr ToastsManager No
vcr ViewContainerRef No

Methods

isDashboardPage
isDashboardPage()
Returns : boolean
isLoginActive
isLoginActive()
Returns : boolean

Properties

title
Type : string
Default value : 'cd'
Public toastr
Type : ToastsManager
import { Component, ViewContainerRef } from '@angular/core';
import { Router } from '@angular/router';

import { ToastsManager } from 'ng2-toastr';
import { TooltipConfig } from 'ngx-bootstrap/tooltip';

import { AuthStorageService } from './shared/services/auth-storage.service';

@Component({
  selector: 'cd-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  providers: [
    {
      provide: TooltipConfig,
      useFactory: (): TooltipConfig =>
        Object.assign(new TooltipConfig(), {
          container: 'body'
        })
    }
  ]
})
export class AppComponent {
  title = 'cd';

  constructor(
    private authStorageService: AuthStorageService,
    private router: Router,
    public toastr: ToastsManager,
    private vcr: ViewContainerRef
  ) {
    this.toastr.setRootViewContainerRef(this.vcr);
  }

  isLoginActive() {
    return this.router.url === '/login' || !this.authStorageService.isLoggedIn();
  }

  isDashboardPage() {
    return this.router.url === '/dashboard';
  }
}
<block-ui>
  <cd-navigation *ngIf="!isLoginActive()"></cd-navigation>
  <div class="container-fluid"
       [ngClass]="{'full-height':isLoginActive(), 'dashboard':isDashboardPage()} ">
    <cd-breadcrumbs></cd-breadcrumbs>
    <router-outlet></router-outlet>
  </div>
<block-ui>

./app.component.scss

@import '../defaults';

.dashboard {
  background-color: $color-whitesmoke-gray;
  margin: 0;
  padding: 0;
}

::ng-deep #toast-container {
  margin-top: 2vw;

  @media (max-width: 1600px) {
    margin-top: 2.5vw;
  }

  @media (max-width: $screen-sm-max) {
    margin-top: 9vw;
  }

  @media (max-width: 900px) {
    margin-top: 10vw;
  }

  @media (max-width: 319px) {
    margin-top: 11vw;
  }

  @media (max-width: 260px) {
    margin-top: 14vw;
  }
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""