1var phonecatApp = angular.module(‘phonecatApp‘, []); //在js中创建自定义模块phonecatApp根模块,在<html lang="en" ng-app="phonecatApp">加载。
2phonecatApp.controller(‘PhoneListCtrl‘, function($scope) {} //在<body ng-controller="PhoneListCtrl">加载control模块。
3ng-app: angular.module(‘phonecatApp‘, []); //根模块
4ng-controller:phonecatApp.controller(‘PhoneListCtrl‘, function($scope) {}
5ng-repeat:<tr ng-repeat="i in [0, 1, 2, 3, 4, 5, 6, 7]">
6ng-model="orderProp" //orderBy:orderProp 按照orderProp的排序方式
7var ListControl=(‘xxxcontroller‘,[‘$scope‘,‘$http‘,function(‘$scope‘,‘$http‘){
$http.get(‘phones/phones.json‘).success(function(data) {
$scope.phones = data.splice(0,3);
});
}]); //从外部数据库中获取数据,这里例举json文件,splice选取0,1,2的共三个数据
8ng-src="{{phone.imageUrl}}" //用js标记src链接
9route:
ng-view: 占位符,用来加载route引导的页面
var phonecatApp = angular.module(‘phonecatApp‘, [
‘ngRoute‘,
‘phonecatControllers‘
]);
phonecatApp.config([‘$routeProvider‘, function($routeProvider) { //routeProvider 页面引导功能
$routeProvider.
when(‘/phones‘, {
templateUrl: ‘partials/phone-list.html‘,
controller: ‘PhoneListCtrl‘ //为不同的页面加载不用的控制器
})
}]);