0
我有以下問題: 我正在使用ng-admin構建管理頁面。有一個自定義頁面添加到ng-admin界面。標準的ng-admin頁面由ng-admin路由,列表/編輯視圖沒有問題。 現在我想爲自定義頁面使用angular.js路由,因爲我需要使用url中的參數進行url路由。 如果我不使用URL中的任何參數,路由確實有效。一旦我使用參數,自定義頁面的路由工作,但當我點擊任何其他頁面時,新頁面永遠加載並且不能打開。如果我使用不帶參數的路由,則所有頁面都會正確加載。在ng-admin中使用angular.js路由
這是工作:
function routing($stateProvider, $urlRouterProvider){
// default route
$urlRouterProvider.otherwise('/custom');
$stateProvider.state('custom', {
parent: 'main',
url: '/custom',
template: customTemplate,
controller: 'CustomController'
});
}
這不是工作:
function routing($stateProvider, $urlRouterProvider){
// default route
$urlRouterProvider.otherwise('/custom');
$stateProvider.state('custom', {
parent: 'main',
url: '/custom?date',
template: customTemplate,
controller: 'CustomController'
});
}
我使用$ state.go功能變化各州和路線的頁面:
function transition(){
var dates = $scope.startdate.getTime();
$state.go('custom', {date: dates}, {notify: false});
};