AngularJS extends HTML through ng-directives .
The ng-app directive defines an AngularJS application. Which is the entrance of the ANGULARJS function in what label or whole body inside
The ng-model directive binds the application data to the HTML controller (input, select, textarea) by binding the value of the element (such as the value of the input field). Two-way binding
The ng-bind directive binds the application data to an HTML view. More used to display content common span labels
The ng-init directive initializes the AngularJS application variable. Define initial values, generally not used
The ng-repeat instruction repeats an HTML element. Multiple traversal for arrays
The ng-controller directive defines the application controller. Using $scope object to invoke the controller, adding properties and methods to $scope in the controller can call the property or method directly in the Ng-model , $scope must write
Instructions
Custom directives: Take advantage of the directive command. For example:
var app = Angular.module ("myApp", []);
App.directive ("runoobdirective", function () {
return {
Restrict: "A",
Template: "};
});
Call the custom command to use the name of the custom command as the attribute class name (comment, label), but you can set the invocation method by restrict
E
Use as an element name is not recommended
A
Use as attribute
C
Recommended for use as a class name
M
Use as a comment is not recommended
Service
$location Get the URL of the page you need to $location as the controller parameters
$http request to the server to obtain data needs to take $http as parameters of the controller
var app = Angular.module (' myApp ', []);
App.controller (' Myctrl ', function ($scope, $http) {
$http. Get ("welcome.htm"). Then (function (response) {
$scope. mywelcome = Response.data;
});
});
How long does $timeout delay Execute
How often do $interval Execute
Custom Service: Invoking the server command
App.service (' alert ', function () {
alert (' Server ')
});
After the call is defined, the name of the custom service needs to be added to the controller's parameters.
The way of AngularJS learning