1
- import { Component , Directive , ElementRef , Inject , Injectable , HostBinding , HostListener , Input , OnInit , Renderer2 , ViewEncapsulation } from '@angular/core' ;
2
- import { Replace } from './. ./shared' ;
1
+ import { Component , Directive , ElementRef , HostBinding , HostListener , Input , OnInit , Renderer2 } from '@angular/core' ;
2
+ import { Replace } from '../shared' ;
3
3
4
4
@Directive ( {
5
5
selector : '[appNavDropdown]'
@@ -37,11 +37,11 @@ export class LinkAttributesDirective implements OnInit {
37
37
constructor ( private renderer : Renderer2 , private el : ElementRef ) { }
38
38
39
39
ngOnInit ( ) {
40
- const attribs = this . appLinkAttributes
41
- for ( let attr in attribs ) {
42
- if ( attr === 'style' && typeof ( attribs [ attr ] ) === 'object' ) {
40
+ const attribs = this . appLinkAttributes ;
41
+ for ( const attr in attribs ) {
42
+ if ( attr === 'style' && typeof ( attribs [ attr ] ) === 'object' ) {
43
43
this . setStyle ( attribs [ attr ] ) ;
44
- } else if ( attr === 'class' ) {
44
+ } else if ( attr === 'class' ) {
45
45
this . addClass ( attribs [ attr ] ) ;
46
46
} else {
47
47
this . setAttrib ( attr , attribs [ attr ] ) ;
@@ -50,20 +50,20 @@ export class LinkAttributesDirective implements OnInit {
50
50
}
51
51
52
52
private setStyle ( styles ) {
53
- for ( let style in styles ) {
53
+ for ( const style in styles ) {
54
54
this . renderer . setStyle ( this . el . nativeElement , style , styles [ style ] ) ;
55
55
}
56
56
}
57
57
58
58
private addClass ( classes ) {
59
- let classArray = Array . isArray ( classes ) ? classes : classes . split ( " " )
59
+ const classArray = Array . isArray ( classes ) ? classes : classes . split ( ' ' ) ;
60
60
classArray . forEach ( element => {
61
- this . renderer . addClass ( this . el . nativeElement , element ) ;
61
+ this . renderer . addClass ( this . el . nativeElement , element ) ;
62
62
} ) ;
63
63
}
64
64
65
65
private setAttrib ( key , value ) {
66
- let newAttr = document . createAttribute ( key ) ;
66
+ const newAttr = document . createAttribute ( key ) ;
67
67
newAttr . value = value ;
68
68
this . renderer . setAttribute ( this . el . nativeElement , key , value ) ;
69
69
}
@@ -181,21 +181,21 @@ export class AppSidebarNavLinkComponent implements OnInit {
181
181
@Input ( ) link : any ;
182
182
183
183
public getClasses ( ) {
184
- const disabled = this . isDisabled ( )
184
+ const disabled = this . isDisabled ( ) ;
185
185
const classes = {
186
186
'nav-link' : true ,
187
187
'disabled' : disabled ,
188
188
'btn-link' : disabled
189
- }
189
+ } ;
190
190
if ( this . hasVariant ( ) ) {
191
191
const variant = `nav-link-${ this . link . variant } ` ;
192
- classes [ variant ] = true ;
192
+ classes [ variant ] = true ;
193
193
}
194
- return classes
194
+ return classes ;
195
195
}
196
196
197
197
public getLinkType ( ) {
198
- return this . isDisabled ( ) ? 'disabled' : this . isExternalLink ( ) ? 'external' : ''
198
+ return this . isDisabled ( ) ? 'disabled' : this . isExternalLink ( ) ? 'external' : '' ;
199
199
}
200
200
201
201
public hasVariant ( ) {
0 commit comments