I have 3 classes in my ng2 Application. The first class manages, which directive is being used by an *ngIf, which by default includes the second class. And in the template of the second class I want to change the directive name from the first class, which would then trigger the first class to recheck the if statement and than select the third class.
Or generally said, is it bad practise to check with *ngIf for the directive to use?
Edit:
as stated by Günter Zöchbauer, here is some Code for what i try to do:
/app/app.component.ts:
template: `
<div *ngIf="template == 'menu'">
<menu></menu>
</div>
<div *ngIf="template == 'entry'">
<entries></entries>
</div>
`
[...]
export class AppComponent {
public template = "menu";
public setTemplate(newTemplate: string) {
this.template = newTemplate;
}
}
/app/menu/menu.component.html:
[...]
(click)="setTemplate('entry')"
[...]
Now I am looking for something to call setTemplate('entry') from the app.component.ts instead of menu.component.ts