I'm trying to create a application with angular 2,and have a auth service in my application , my html template is somthing like this:
<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>
**and this 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 is here
return this._user.authorized();
}
}
always my functions is executing !(in my auth service i have another fuctions that they also runing) !this is for using a function inside *ngif ??!!! im worry for my resoureces and i want know its a problem or not?