I'm working on developing an application using Angular 2 and implementing an auth service. Here is a snippet of my HTML template:
<header>
<div *ngIf="isLogin()"><a href="">profile</a></div>
<div *ngIf="!isLogin()"><a href="">register</a></div>
<div *ngIf="!isLogin()"><a href="">signin</a></div>
</header>
**Here is my class:**
@Component({
selector: 'main-menu',
templateUrl: '/client/tmpl/menu.html',
directives: [ROUTER_DIRECTIVES]
})
export class Menu extends Ext {
public items: any;
constructor(private _util: UtilService, private _user: UserService) {
super();
}
public isLogin() {
console.log("test"); <==== my problem occurs here
return this._user.authorized();
}
}
My functions seem to be executing continuously, especially when using a function inside *ngif. This raises concerns about resource consumption. Is this a potential issue that I should address?