var app =angular.module('app',['ngRoute']);
app.config(['$routeProvider',function($routeProvider){
$routeProvider.when('/a',{template:'
ng-view html
'})
.when('/b',{template:'
ng-view css
'})
.when('/c',{
templateUrl:'./list.html', //templateUrl:' 引入文件.html'
controller:"listCTRL" //数据所属控制器
})
.otherwise({redirectTo:'/'});
}]);
app.controller('actrl',['$scope',function($scope){
$scope.hello ='hello world';
}]);
app.controller('listCTRL',['$scope',function($scope){
//传入数据
$scope.list = ["新 浪",'搜 狐','凤凰网','头 条','腾 讯','今日热点',];
}]);
//$routeParams服务,它可以让你获取当前路由的参数(它实际上是$location.search()和path()的结合体)。
app.controller('listCTRL',['$scope','$routeParams',function($scope,$routeParams){
//传入数据
$scope.list = ["新 浪",'搜 狐','凤凰网','头 条','腾 讯','今日热点',];
// http://localhost:63342/%E5%AD%A6%E4%B9%A0Angular/html/ag04-ngrout.html#/c?name=xjh&age=33
// {name: "xjh", age: "33"}
console.log($routeParams);
}]);