Reputation: 3447
I have a register form and I wish to display an error message on the form, in case something went wrong.
In my .ts file, I have the following code :-
onSubmit(email, password, name, surname, username, homephonenumber, mobilenumber){
this._userService.register(email, password, name, surname, username, homephonenumber, mobilenumber)
.subscribe((result) => {
if (result.success == "True") {
//this._userService.login(email, password);
}
else
{
this.errorMessage = result.message;
}
});
}
And in my form I have the following:-
<div class="alert alert-danger" ng-if="{{errorMessage}}"></div>
This is throwing an error in the console:-
Can't bind to 'ng-if' since it isn't a known property of 'div'
How can I get the error message to display?
Thanks for your help and time.
Upvotes: 1
Views: 3797