Angularjs some small points of attention

Source: Internet
Author: User

I have just contacted Angularjs, not too familiar with, tell me about some of the points I have encountered at the moment.

1. Calling the foreign file script file

MVC design Pattern

HTML file

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title></title>
<body>

    ng means angular, ng-app on this line of Div, decides where to put the angular script, which means that the div is valid only in this line, Ng-controller represents the controller; Greeting.Text represents the module parameter

    Note: When the foreign file is transferred, Ng-app does not need to take parameters, such as: ng-app= "MyAPP"
<div ng-app ng-controller= "helloangular">
<p>{{greeting.text}},Angular</p>
</div>
<script type= "Text/javascript" src= "js/angular.min.js" ></script>//angularjs encapsulated files
<script type= "Text/javascript" src= "js/angular.js" ></script>//script foreign files written by yourself
</body>

Scrript file

No (function () {expression}) (), only one function helloangular (ng-controller parameter) {expression} is required

function Helloangular ($scope) {
$scope. Greeting = {
Text: ' Hello '
};
}

Angularjs some small points of attention

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.