棱角分明的UI路由器视图和控制器升级到1.3角后不加载 [英] angular-ui-router views and controllers are not loading after upgrading to angular 1.3

查看:237
本文介绍了棱角分明的UI路由器视图和控制器升级到1.3角后不加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了更新,以角1.3我不能达到控制器和视图后,他们根本不会加载。

after I did the update to angular 1.3 I'm not able to reach the controllers and views, they simply doesn't load.

在我的根的作品完美的状态,这是我app.js

the states in my root works perfectly, this is my app.js

$stateProvider.state("root",
    {
        url: '',
        abstract: true,
        views: {
            'footer@': {
                templateUrl: "/partial/footer/footer.html",

            },
            'header@': {
                templateUrl: "/partial/header/header.html",
            }
        }
    }).state('root.home', {
            url: '/index',
            views: {
                'container@': {
                    templateUrl: '/partial/index/index.html',
                    controller: 'IndexCtrl'
                }
            }
        }
    ).state('root.welcome', {
        url: '/index/:status',
        views: {
            'container@': {
                templateUrl: '/partial/index/index.html',
                controller: 'IndexCtrl'
            }
        }
    });

这是也是我的配置:

$urlRouterProvider.otherwise('index');
$locationProvider.hashPrefix('!');
$locationProvider.html5Mode({ enabled: false });

做一个stage.go后,或只是键入URL,我不能在这些州达成任何路线

$stateProvider.state("candidate",
    {
        url: '',
        abstract: true,
        views: {
            'footer@': {
                templateUrl: "/partial/footer/footer.html"
             },
            'header@': {
                templateUrl: "/user/partial/user.header/user.header.html",
            },
            'sideBar@': {
                templateUrl: '/user/partial/user.sidebar/user.sidebar.html',
                controller: 'SidebarCtrl',
                resolve: {
                    user: 'currentUser'
                }
            },
            'navBar@': {
                templateUrl: '/user/partial/navbar/navbar.html'
            }
        }
    }).state('candidate.dashboard',
    {
        url: '/dashboard',
        views: {
            'container@': {
                templateUrl: '/user/partial/user.dashboard/user.dashboard.html',
                controller: 'DashboardCtrl',
                resolve: {
                    dashboardinfo: function ($resource, tracker) {
                        var resourceGet = $resource('/user/dashboard');
                        var promise = resourceGet.get().$promise;
                        tracker.addPromise(promise);
                        return promise;
                    }
                }
            }
        }
    })

我已经花了几个小时试图弄清楚这一点没有任何运气,也许这只是一个小细节我错过,任何意见会更受欢迎。

I've spent a couple of hours trying to figure this out without any luck, maybe it's just a small detail I'm missing, any advice will be more than welcome.

PS:我使用v0.2.12- pre1

PS: I'm using v0.2.12-pre1

推荐答案

事实证明,决心方法不灵了,我采用了棱角分明的诺言跟踪

it turns out that the resolve method was failing, I'm using angular promise tracker

 var resourceGet = $resource('/user/dashboard');
 var promise = resourceGet.get().$promise;
 tracker.addPromise(promise); <-- fails here
 return promise;

好像资源和承诺有重大更改,我的执行可能会去precated。

it seems like resources and promises have breaking changes and my implementation could be deprecated.

这篇关于棱角分明的UI路由器视图和控制器升级到1.3角后不加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆