-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (30 loc) · 878 Bytes
/
Copy pathindex.js
File metadata and controls
34 lines (30 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
angular.module('sampleApp', ['ngRoute', 'pascalprecht.translate'])
.config(function($routeProvider, sampleList) {
var list = sampleList.list;
console.log(list);
// 下一步细化路由,细化模块结构
for (var i = 0, r; r = list[i]; i++) {
$routeProvider.when("/" + r, {
templateUrl: "modules/" + r + "/" + r + ".htm"
});
}
// 默认路由道list的第一项
$routeProvider.otherwise({
redirectTo: '/' + list[0]
});
})
.config(function($translateProvider) {
$translateProvider.translations('en', {
'key': 'Hello key',
'FOO': 'This is a paragraph'
});
$translateProvider.translations('zh', {
'key': '你好 关键字',
'FOO': '这是一幅图'
});
$translateProvider.preferredLanguage('zh');
})
.controller('navController', function($scope, sampleList) {
$scope.data = sampleList;
console.log(sampleList);
})