.config(["$routeProvider", 'partial', 'contentUrl', 'appContext', function ($routeProvider, partial, contentUrl, appContext) {
$routeProvider
.when('/notifications', {
templateUrl: partial('popup.html'),
controller: 'popUpCtrl',
resolve: {
notifications: ['$http', function($http) {
return $http.post(
appContext('ViewAllNotifications.json'),
{"categoryGroupType":"ROLB","isArchived":"N","channelTypeCode":"101","limit":"20","page":"0","customerType":"A"}
);
}]
}
})
;
}])
上面的代码完全正常。我想在此做一些基于条件的路由。我能做点什么吗?
.config(["$routeProvider", 'partial', 'contentUrl', 'appContext', function ($routeProvider, partial, contentUrl, appContext) {
$routeProvider
.when('/notifications',
if(something){
templateUrl: partial('popup.html'),
controller: 'popUpCtrl',
resolve: {
notifications: ['$http', function($http) {
return $http.post(
appContext('ViewAllNotifications.json'),
{"categoryGroupType":"ROLB","isArchived":"N","channelTypeCode":"101","limit":"20","page":"0","customerType":"A"}
);
}]
}
}
else{
templateUrl: partial('popup2.html'),
controller: 'popUpCtrl',
resolve: {
notifications: ['$http', function($http) {
return $http.post(
appContext('ViewAllNotifications2.json'),
{"categoryGroupType":"ROLB","isArchived":"N","channelTypeCode":"101","limit":"20","page":"0","customerType":"A"}
);
}]
}
})
;
}])
基本上我想基于布尔值加载另一个部分。有人可以指导我完成这个吗?我对角度很新。