1. The template binding mechanism of angularjs seems to be related to its $ HTTP service. If the jquery Ajax return value is assigned to the scope variable of $ scope, the entire binding display is slow, so it is really troublesome.
2. binding the hidden input seems invalid.
3. There is a conflict between binding ng-model of input in angularjs and assigning values to input values. If a model is bound, values cannot be assigned.
4. If the input is not ng-model bound, the input verification mechanism may be faulty: the error message cannot be displayed. Observe the scope and you will find that the error value corresponding to that input does not exist.
5. According to the two conditions 3 and 4, it is best to use ng-model to initialize the form data. When initializing the $ scope variable, you can only copy the first-level subattribute, for example, $ scope. Attr1. If you directly perform secondary attributes, $ scope. Attr1.attr2 value assignment, because the $ scope. The attr1 object has not been created yet, which may cause code errors.
6. There is an article on dependency injection: http://www.cnblogs.com/lcllao/archive/2012/09/23/2699401.html. The recommended method for dependency injection is as follows:
var MyController = function (dep1, dep2) {
...
}
MyController. $ Inject = ['dep1', 'dep2'];
MyController.prototype.aMethod = function () {
...
}
Unfortunately, this method is not effective for non-Provider dependency injection, so the safer method is the method given in the first 14 pages of the AngularJS book:
var myAppModule = angular.module ('myApp', []);
myAppModule.controller ('TextController',
function ($ scope) {
var someText = {};
someText.message = 'You have started your journey.';
$ scope.someText = someText;
});
The most troublesome thing about this method is that you have to add an attribute value such as "myApp" to the ng-app of HTML, and there is a problem in this place that you have to define myapp with JS, otherwise JS will run wrong. Suggest
var myApp = angular.module ('myApp', []);
Such a statement should be placed on the first line of the site's personalized customization code.