<div>
First Name : {{ employee.firstName }}</div>
<div>
Last Name : {{ employee.lastName }}</div>
<div>
Gender : {{ employee.gender}}</div>
</div>
What happens if the controller name is misspelled
When the controller name is misspelled, 2 things happen
1. An error is raised. To see the error, use browser developer tools
2. The binding expressions in the view that are in the scope of the controller will not be evaluated
If you are using the minified version of the AngularJS script, the error messages may not be readable. To get readable error message
1. In the developer tools, click on the link next to the error. This will lead you to a page, where you can see a much clean error message without all the encoding symbols.
2. Another option you have is, if you are in the development environment, you may use the non-minified version of the AngularJS script, which produces readable error message.
What happens if a property name in the binding expression is misspelled
Expression evaluation in angular is forgiving, meaning if you misspell a property name in the binding expression, angular will not report any error. It will simply return null or undefined.
How to create module, controller and register the controller with the module, all in one line
Use the method chaining mechanism as shown below
var myApp = angular
.module("myModule", [])
.controller("myController", function ($scope) {
var employee = {
firstName: 'Mark',
lastName: 'Hastings',
gender: 'Male'
};
$scope.employee = employee;
});
0 comments :
Post a Comment