-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
43 lines (41 loc) · 1.02 KB
/
Copy pathapp.js
File metadata and controls
43 lines (41 loc) · 1.02 KB
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
35
36
37
38
39
40
41
42
43
var app = angular.module('app', [
'ngAnimate',
'ngRoute',
'appController'
]);
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.when('/abc', {
templateUrl: 'temp/abc.html'
}).when('/blog', {
templateUrl: '/blog'
}).when('/ABC', {
template: '<h1 class="ABC">ABC</h1>'
}).otherwise({
redirectTo: '/abc'
});
}]);
var appController = angular.module('appController', []);
appController.controller('viewCtrl', ['$rootScope', '$scope', '$location', function ($rootScope, $scope, $location) {
$scope.$on('$routeChangeSuccess', function (event) {
if(/\/blog/.test($location.path())){
$scope.isBack = false;
return false;
}else{
$scope.isBack = true;
}
})
}]);
app.run(['$rootScope', function ($rootScope) {
$rootScope.temp = [{
url: '/abc'
}, {
url: '/ABC',
children: {
url: '/def'
}
},
{
url: '/blog'
}
];
}]);