Simple I need help how should update code for update viewing. The alert is
show just msg: 'Well done! You successfully read this important alert
message.',
when during the app add function addAlert() second msg: 'Another alert!' are
not showing , but in console.log are appearing.
I trying Observer , EventEmitter without success.
@Component({
selector: 'alert-demo1',
template: `
<alert *ngFor="#alert of alerts;#i = index" [type]="alert.type"
dismissible="true" (close)="closeAlert(i) ">
{{ alert?.msg }}
</alert>
`,
directives: [Alert, CORE_DIRECTIVES]
})
@Injectable()
export class AlertDemo {
@Input() alerts:Array<Object> = [
{
type: 'success',
msg: 'Well done! You successfully read this important alert message.',
closable: true
}
];
public closeAlert(i:number):void {
this.alerts.splice(i, 1);
}
public addAlert():void {
console.log('AlertDemo.class addAlert()');
this.alerts.push({msg: 'Another alert!', type: 'warning', closable: true});
for (var alert of this.alerts){
console.log(alert.type+' '+alert.msg);
}
}
}
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.