在调用http://localhost:8199/#/iceberg-ui之后,我现在在主页上
我有一个名为iceberg.reconcreate的状态,定义如下。
但是,当我试图在单击按钮时调用$state.go('iceberg.reconcreate')时,会得到未定义状态的错误。
.ui:982个未定义的错误:在Object.transitionTo (angular router.js:982)在HTMLAnchorElement (angular router.js:973)处没有未定义的状态。HTMLAnchorElement.dispatch (jquery.js:4641) at HTMLAnchorElement.elemData.handle (jquery.js:4309)
路由
routingSetup.$inject = ['$stateProvider', '$urlRouterProvider'];
function routingSetup($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/iceberg-ui");
$stateProvider
.state('iceberg', {
url: "/iceberg-ui",
templateUrl: "app/iceberg/iceberg.view.html",
controller: 'IcebergController as icebergCtrl'
})
.state('iceberg.reconlist', {
templateUrl: "app/iceberg/recon/list/recon.list.view.html",
controller: 'ReconListController as reconListCtrl'
})
.state('iceberg.reconcreate', {
templateUrl: "app/iceberg/recon/create/recon.create.view.html",
controller: 'ReconCreateController as reconCreateCtrl'
})
.state('iceberg.recondetails', {
templateUrl: "app/iceberg/recon/details/recon.details.view.html",
controller: 'ReconDetailsController as reconDetailsCtrl'
})
}控制器
(function() {
'use strict';
var myApp = angular.module('iceberg.recon');
myApp.controller('ReconListController', ReconListController);
ReconListController.$inject = ['ReconListService', '$state'];
function ReconListController(ReconListService, $state) {
var vm = this;
function getReconciliationList() {
return {
load: function(loadOptions) {
var reconList = ReconListService.getReconciliationList();
return {
data: reconList,
totalCount: reconList.length
};
},
update: function(key, values) {
console.log("calling the UPDATE GRID");
//Do Nothing, this method is required else the framework throws an error
}
};
}
vm.createNewRecon = {
text: "Create New Reconciliation",
icon: "plus",
type: "success",
height: "45px",
onClick: function(e) {
$state.go('iceberg.reconcreate');
}
};
}
}());更新-更新控制器详细信息
发布于 2017-05-03 11:06:38
抱歉伙计们那是我的疏忽。我用不正确的名称定义了一个ui-sref,当我认为它被称为onclick事件时,所有这些都是错误的。我的错,为同样的事道歉。
https://stackoverflow.com/questions/43756891
复制相似问题