Angular JS Knowledge Small Summary

Source: Internet
Author: User

1. What is angular JS?

AngularJS is a JavaScript architecture Framework designed for dynamic Web applications.

What is the use of 2.Angular JS?

--it is designed to overcome the lack of HTML in building applications;

--for CRUD applications, to eliminate DOM manipulation on the page. Its core idea is to draw on the MVC framework, but it's actually closer to Mvvm.viemmodel is a native JavaScript object, Angularjs the view and model to the Viemmodel, which enables data binding. And this binding is bidirectional, that is, the view changes, the corresponding model will also change, the same model changes will cause the corresponding view changes.

--mainly used for the development of single page application, it supports browser history operation, forward Back button, single page application in the collection operation.

--Not all applications are suitable for use with ANGULARJS, such as game development, or applications that require a lot of manipulation of the DOM, or simply requiring very high speed of operation.

Features of 3.Angular JS

-Bidirectional data binding: This is the core function of the Angularjs module--** binding **,ng-model and {{}} implement a two-way binding, if the controller and Ng-model both exist on an input box or element, the page is loaded, The corresponding element will show the default values set in the controller, and once the view is manually modified, the Ng-model will take effect. Controller controllers, one-way bindings can be implemented.

--modularity: In Angularjs, a template is an HTML file. Auguarjs does not manipulate the template as a string. The input angularjs is DOM rather than string. Data binding is a DOM change, not a connection to a string or a innerhtml change. Using the DOM as input, rather than as a string, is the biggest reason ANGULARJS differs from other frameworks.

--Service and Dependency injection: Angularjs has a built-in dependency injection (DI) subsystem, and DI allows you to request your dependencies instead of looking for them, i.e. "passively accept", that is, if you need an object or variable, as long as you have a angularjs in it, just declare it, You can use it.

--Instruction: Angular JS has a lot of its own ng-directives, can help us to operate the DOM, in addition, we can also customize the instructions, with the Angular module directive method.

4. A few important items

--Ng-app: General home on the outermost root element, defines the scope of the Angularjs script;
--Ng-model: Binds the label or attribute on the view to the Viemmodel;
--{{}}:ANGULARJS expression, the function is to show the model in ViewModel to the view.
-$scope: This is the core object of Angularjs, the ViewModel object, which cannot be changed and is obtained by dependency injection.

5. Write the basic process of ANGULARJS:

Page
--First Use <script> tags, import angular.min.js file;
--Generally define the scope of the Angularjs script in the root element --Define the scope of the controller, in the label ' ng-controller= ' Mycontroller "';
--If the data is bound to Viemmodel, use the ng-model instruction on the corresponding label, or the {{}} to display.

Js
--Load the required module ' var MyApp = angular.module ("MyApp", []) '; the second parameter is the module that the module depends on, no, not fill in
--Myapp.controller ("Mycontroller", function ($scope) {...}; The Controller method call, a parameter of the callback function must be $scope, so as to get to $scope, thus manipulating the data.

Angular JS Knowledge Small Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.