I'm having trouble implementing a simple server-side form validation using angular 2.
given the following scenario:
- Simple form with fields for login and password. (attached to component view via ngForm / ngModel directives)
- Template Based Form
- Using synchronous validation
- Server response. The JSON object has the following
{field: error}
ex form , if the login and password are empty, the answer is:{login: 'required', password: 'required'}
As soon as it is sent, I have a response from the server, but I do not know how to update the state of each ngModel associated with the view control to show it in the user interface
This is a very common scenario, and I am surprised that I have many problems finding the right documentation. (customer check is very well explained, on the other hand)
Any help appreciated! Greetings :)
source
share