Angularjs Can';t使用urlRouterProvider调用控制器
我试着让这个工作,花了5个多小时,张贴在这里是最后的手段 app.jsAngularjs Can';t使用urlRouterProvider调用控制器,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我试着让这个工作,花了5个多小时,张贴在这里是最后的手段 app.js app.config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('tab', { url: "/tab", abstract: true, templateUrl: "tabs.html" }) // the pet tab has its own c
app.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "tabs.html"
})
// the pet tab has its own child nav-view and history
.state('tab.pet-index', {
url: '/pets',
views: {
'pets-tab': {
templateUrl: 'pet-index.html',
controller: 'PetIndexCtrl'
}
}
})
.state('tab.pet-detail', {
url: '/pet/:petId',
views: {
'pets-tab': {
templateUrl: 'pet-detail.html',
controller: 'PetDetailCtrl'
}
}
});
console.log('app load ...');
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/pets');
});
这里我调用$urlRouterProvider。否则('/tab/pets')
但我没能得到控制器:
app.controller('PetIndexCtrl', function($scope, PetService) {
console.log('PetIndexCtrl load ...');
$scope.pets = PetService.all();
});
我做错了什么?请帮忙
谢谢,这似乎可以归结为
离子-
前缀在几个地方缺失
当我将导航视图
更改为离子导航视图
,选项卡
更改为离子选项卡
等时,一切似乎正常
谢谢你,伙计,你为我节省了时间,没想到