1
- import { Component , ElementRef , Input , OnInit , OnDestroy , Inject , Renderer2 } from '@angular/core' ;
1
+ import { Component , ElementRef , Input , OnInit , OnDestroy , Inject , Renderer2 } from '@angular/core' ;
2
2
import { DOCUMENT } from '@angular/common' ;
3
3
4
4
import { Replace } from '../shared' ;
@@ -15,23 +15,14 @@ import { Replace } from '../shared';
15
15
<a class="navbar-brand" [href]="navbarBrandHref">
16
16
<ng-template [ngIf]="navbarBrandImg">
17
17
<img *ngIf="navbarBrand"
18
- [src]="imgSrc(navbarBrand)"
19
- [attr.width]="imgWidth(navbarBrand)"
20
- [attr.height]="imgHeight(navbarBrand)"
21
- [attr.alt]="imgAlt(navbarBrand)"
22
- class="navbar-brand">
18
+ [appHtmlAttr]="navbarBrand"
19
+ [ngClass]="'navbar-brand'">
23
20
<img *ngIf="navbarBrandFull"
24
- [src]="imgSrc(navbarBrandFull)"
25
- [attr.width]="imgWidth(navbarBrandFull)"
26
- [attr.height]="imgHeight(navbarBrandFull)"
27
- [attr.alt]="imgAlt(navbarBrandFull)"
28
- class="navbar-brand-full">
21
+ [appHtmlAttr]="navbarBrandFull"
22
+ [ngClass]="'navbar-brand-full'">
29
23
<img *ngIf="navbarBrandMinimized"
30
- [src]="imgSrc(navbarBrandMinimized)"
31
- [attr.width]="imgWidth(navbarBrandMinimized)"
32
- [attr.height]="imgHeight(navbarBrandMinimized)"
33
- [attr.alt]="imgAlt(navbarBrandMinimized)"
34
- class="navbar-brand-minimized">
24
+ [appHtmlAttr]="navbarBrandMinimized"
25
+ [ngClass]="'navbar-brand-minimized'">
35
26
</ng-template>
36
27
<ng-template [ngIf]="!navbarBrandImg">
37
28
<div class="navbar-brand-full" [innerHTML]="navbarBrandText.text"></div>
@@ -73,6 +64,7 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
73
64
@Input ( ) asideMenuToggler : any ;
74
65
@Input ( ) mobileAsideMenuToggler : any ;
75
66
67
+ private readonly fixedClass = 'header-fixed' ;
76
68
navbarBrandImg : boolean ;
77
69
78
70
constructor (
@@ -88,33 +80,12 @@ export class AppHeaderComponent implements OnInit, OnDestroy {
88
80
}
89
81
90
82
ngOnDestroy ( ) : void {
91
- this . renderer . removeClass ( this . document . body , 'header-fixed' ) ;
83
+ this . renderer . removeClass ( this . document . body , this . fixedClass ) ;
92
84
}
93
85
94
86
isFixed ( fixed : boolean = this . fixed ) : void {
95
87
if ( fixed ) {
96
- this . renderer . addClass ( this . document . body , 'header-fixed' ) ;
88
+ this . renderer . addClass ( this . document . body , this . fixedClass ) ;
97
89
}
98
90
}
99
-
100
- imgSrc ( brand : any ) : void {
101
- return brand . src ? brand . src : '' ;
102
- }
103
-
104
- imgWidth ( brand : any ) : void {
105
- return brand . width ? brand . width : 'auto' ;
106
- }
107
-
108
- imgHeight ( brand : any ) : void {
109
- return brand . height ? brand . height : 'auto' ;
110
- }
111
-
112
- imgAlt ( brand : any ) : void {
113
- return brand . alt ? brand . alt : '' ;
114
- }
115
-
116
- breakpoint ( breakpoint : any ) : void {
117
- console . log ( breakpoint ) ;
118
- return breakpoint ? breakpoint : '' ;
119
- }
120
91
}
0 commit comments