1
我想從一個孩子的狀態進入一個孩子的狀態進入一個孩子的狀態,但我得到:angular.js:14195 Error: Could not resolve '#/projects/detailProject' from state 'projects.list
從子狀態
這些都是狀態:
function routeConfig($stateProvider, $urlRouterProvider) {
$stateProvider
.state('projects', {
url: '/projects',
template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
title: 'Les projets',
controller : 'ProjectController',
sidebarMeta: {
icon: 'ion-compose',
order: 250,
},
})
.state('projects.add', {
url: '/add',
templateUrl: 'app/pages/projects/add/projects.html',
title: 'Ajouter un projet',
sidebarMeta: {
order: 800,
},
})
.state('projects.list', {
url: '/list',
params : { projectId : null},
templateUrl: 'app/pages/projects/list/listProjects.html',
title: 'List',
sidebarMeta: {
order: 900,
},
})
.state('projects.detail', {
url: '/detail',
templateUrl: 'app/pages/projects/detail/detailProject.html',
title: 'Detail du projet',
});
$urlRouterProvider.when('/projects','/projects/list');
}
我試圖訪問子狀態低谷:
<button type="button" id="Edit" name="Edit" ng-click="goToPath('#/projects/detailProject', p.id)"class="btn btn-primary btn-raised">Editer</button></div>
'這是我的goToPath方法:
$scope.goToPath = function (path, pid) {
$scope.pid = pid;
$state.go(path, {projectId : pid});
};
謝謝。