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