How do we reset the controls with validation states of Template driven forms in angular 2? I know that controls can be reset by setting model values to which they are bound to. But what about the validation states(pristine, dirty etc..)?
I tried something like this:
<form (ngSubmit)="onSubmit(playlistForm)" #playlistForm="ngForm">
// Some code here...
</form>
And in controller,
onSubmit(playlistForm: any) {
// ...
playlistForm.form.reset();
}
But in above seems to actually redirect to the ''
And I get error below:
EXCEPTION: Error: Uncaught (in promise): Error: Cannot match any routes: ''
So how do I do what I want?