Skip to content

Commit df3d201

Browse files
committed
refactor(app-sidebar-nav): minor changes
1 parent 9f07c82 commit df3d201

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

projects/coreui/angular/src/lib/sidebar/app-sidebar-nav.component.ts

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
import { Component, Directive, ElementRef, HostBinding, HostListener, Input, OnInit, Renderer2 } from '@angular/core';
1+
import {
2+
Component,
3+
Directive,
4+
ElementRef,
5+
HostBinding,
6+
HostListener,
7+
Input,
8+
OnChanges,
9+
OnInit,
10+
Renderer2,
11+
SimpleChanges
12+
} from '@angular/core';
213
import { Replace } from '../shared';
314

415
@Directive({
@@ -84,12 +95,14 @@ export class LinkAttributesDirective implements OnInit {
8495
</ng-template>
8596
</ul>`
8697
})
87-
export class AppSidebarNavComponent {
88-
@Input() navItems: any;
98+
export class AppSidebarNavComponent implements OnChanges {
99+
@Input() navItems: Array<any>;
89100

90101
@HostBinding('class.sidebar-nav') true;
91102
@HostBinding('attr.role') role = 'nav';
92103

104+
public navItemsArray: Array<any>;
105+
93106
public isDivider(item) {
94107
return item.divider ? true : false;
95108
}
@@ -98,6 +111,10 @@ export class AppSidebarNavComponent {
98111
return item.title ? true : false;
99112
}
100113

114+
public ngOnChanges(changes: SimpleChanges): void {
115+
this.navItemsArray = JSON.parse(JSON.stringify(this.navItems));
116+
}
117+
101118
constructor() { }
102119
}
103120

0 commit comments

Comments
 (0)