Implementing the user View

For the user view, Listing 26.13 implements two simple forms. The first allows you to modify the email and color preferences of the user. The body contains a <div> element that creates an instance of an AngularJS controller that gets the user information from the webserver. The username <input> element is set to disabled to prevent the user from changing the username.

Notice that the inputs are bound to the $scope.user value in the AngularJS scope by using ng-model. Also notice that the form methods are POST but also include the action attribute, which specifies the route to use to save or delete the user. Remember that using the action attribute overrides the AngularJS suppression of the normal <form> functionality. ...

Get Node.js, MongoDB, and AngularJS Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.