Consider this Child Component:
@Component({
selector: 'mySelector',
template: `<ion-spinner [ngIf]="ngif"></ion-spinner>`
})
export class MyDirective {
ngif: boolean;
constructor() {}
@Input() serverWaiting:boolean = true;
@HostBinding('ngIf')
ngOnChanges() {
this.ngif = !this.serverWaiting ? true : null;
}
The Host Component's Template:
<mySelector [serverWaiting]></mySelector>
The Host Component:
@Component({
templateUrl: 'hostComp.html',
directives: [myDirective]
})
export class HostComp {
serverWaiting = true;
}
Yet, the Spinner is not shown. Any idea what I am doing wrong?
Sources: https://angular.io/docs/ts/latest/api/common/index/NgIf-directive.html