首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法转换到状态,则无法获得未定义状态的错误。

无法转换到状态,则无法获得未定义状态的错误。
EN

Stack Overflow用户
提问于 2017-05-03 10:01:02
回答 1查看 903关注 0票数 0

在调用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)

路由

代码语言:javascript
复制
    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'
        })
}

控制器

代码语言:javascript
复制
(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');
        }
    };

}
}());

更新-更新控制器详细信息

EN

回答 1

Stack Overflow用户

发布于 2017-05-03 11:06:38

抱歉伙计们那是我的疏忽。我用不正确的名称定义了一个ui-sref,当我认为它被称为onclick事件时,所有这些都是错误的。我的错,为同样的事道歉。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43756891

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档