AngularJS (4)

Source: Internet
Author: User

AngularJS (4)

One: Scope of ANGULAJS scope

Scope (scope) is the link between HTML (view) and JavaScript (controller).
Scope is a JavaScript object with properties and methods that can be used in views and controllers.
Scope can be applied to views and Controllers.
The AngularJS application consists of the Following: $scope is a model
view, which is HTML.
Model (models), the data available in the current VIEW.
controller, the JavaScript function, can add or modify Properties.

As mentioned in the previous content, there is only one scope, but in large projects, there may be multiple scopes

As in the following example:

<div ng-app= "myapp" >     

Two: root scope of ANGULARJS

All applications have a $rootScope that can function in all HTML elements contained in the NG-APP directive

$rootScope can act on the entire Application. is the bridge of scope in each controller. Values defined with Rootscope can be used in each controller.

As in the following example:

<div ng-app= "myapp" >    

Turn

AngularJS (4)

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.