in html i warning should only be displayed when an error occurs, e.g. thius
<div class="alert alert-danger" *ngIf="error"> <strong>Not saved!</strong> There was an error when saving the project. Please try again later. </div>
this works great. but when I set the value from observable, ngIf does not get the updated value.
Here's a simplified code that always sets the error to true for testing purposes
export class createProjectComponent { constructor(private service:ProjectsService){ } model = new myModel(); error = false; submitForm(){ this.service.createProject(this.model).subscribe(i=>{ this.error=true; } }
is there some kind of notification i should call?
source share