In Angular.js, a specialized ViewModel (view model) is introduced to bond the view and model, allowing further separation and decoupling of the view and model.
Advantage:
1. Low coupling
2. reusability
3. Independent development
4. testability
Mvc
Model View Controller
Model-View-control
Data-page-Business processing
Views: pages for direct user action
Model: All data that participates in the operation (filtering, filtering, sorting, crud, etc.)
Control: Data transfer
Core function Modules of Angular.js
1, the data binding
2. Filter
3. Routing
4. Scope
5. Instruction Set
6. Templates
7. Dependency Injection
Using Angular.js
1 <!DOCTYPE HTML>2 <HTMLNg-app= "MYAPP"Ng-controller= "Myctrl">3 <!--4 Description: Introduction of ng-app= "MYAPP" ng-controller= "Myctrl" in the HTML header5 -6 <Head>7 <MetaCharSet= "Utf-8" />8 <title>Angular.js's instructions.</title>9 </Head>Ten <Body> One <Scriptsrc= "Js/angular.js"></Script> A <Script> - /* - * Introduce the following code in JS code to use Angular.js the */ - Angular.module ("myApp ", []). Controller ("Myctrl ", function($scope) { - //The angular.js handler function "MYAPP" corresponds to the value of Ng-app; "Myctrl" corresponds to the value of Ng-controller; - }); + </Script> - </Body> + </HTML>
Ng-app directive Initializes a AngularJS application.
Ng-controller directive is used to add a controller to your app.
Understanding Angularjs and Angularjs simple and practical