标签:
AngularJS is a JavaScirpt web framework amied to make web apps simple to build and easy to maintain.
Files
===================================================
CSS
- main.css
img
- program-or-be-programmed.jpg
- the-book-of-trees.jpg
js
controllers
- MainController.js
shared
- angular-mocks.js
- angular-route.min.js
- angular-min.js
- app.js
index.html
===================================================
Step 1:
In app.js, created a new module named myApp. a module contains the different components of an AngularJS app.
var app = angular.module("myApp", []);
Step 2:
in index.html, <body ng-app="myApp">.
ng-app is a directive, it tells AngularJS that the myApp module will live within the <body> element.
Step 3:
In MainController.js we created a new controller named MainController. A controller manage the app‘s data.
Step 4:
in index.html, added
<div class="main" ng-controller="MainController"> Like ng-app, ng-controller is a directive that defines the controller scope.
Step 5:
Inside <div class="main"> we accessed $scope.tittle using {{title}}.
标签:
原文地址:http://www.cnblogs.com/elewei/p/5772485.html