使用UI的路由器粘额外国家不能过渡到previously激活状态 [英] Can't transition to previously activated state using ui-router-extras Sticky State

查看:102
本文介绍了使用UI的路由器粘额外国家不能过渡到previously激活状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 UI的路由器额外置顶状态(并行州)和深州重定向按的 http://christopherthielen.github.io/ui-router-extras/#/sticky ,我无法过渡到这是一个状态previously激活。

Using ui-router-extras Sticky State (Parallel States) and Deep State Redirect as per http://christopherthielen.github.io/ui-router-extras/#/sticky, I'm unable to transition to a state that was previously activated.

app.js

'use strict';

angular.module( 'StickyStateDemo', [
  'ui.router',
  'ct.ui.router.extras',
  'StickyStateDemo.controllers'
])

.config(function($stateProvider, $stickyStateProvider, $urlRouterProvider) {

    var states = [];
    $stickyStateProvider.enableDebug(true);

    states.push({name: 'contentview', url: '/',
      views: {
        '@': {controller: 'ContentViewCtrl', templateUrl: 'contentView.tpl.html'}
    }});

    states.push({name: 'contentview.small', url: 'small/{myId}',
      views: {
        'smallview@contentview': {controller: 'SmallViewCtrl', templateUrl: 'smallView.tpl.html'}},
      deepStateRedirect: true, sticky: true
    });

    states.push({name: 'contentview.large', url: 'large/{myId}',
      views: {
        'largeview@contentview': {controller: 'LargeViewCtrl', templateUrl: 'largeView.tpl.html'}},
      deepStateRedirect: true, sticky: true
    });

    angular.forEach(states, function(state) { $stateProvider.state(state); });
    $urlRouterProvider.otherwise('/');
  })

.run( function run ($rootScope, $state, $stateParams) {
    $rootScope.$state = $state;
    $rootScope.$stateParams = $stateParams;
});

controllers.js

controllers.js

'use strict';
angular.module('StickyStateDemo.controllers', []);

angular.module('StickyStateDemo.controllers')

.controller('MainCtrl', function ($scope, $state) {
    $scope.launchSmallView = function() {
      $state.go('contentview.small', {myId: 1});
    };

    $scope.launchLargeView = function() {
      $state.go('contentview.large', {myId: 1});
    };
  })

.controller('ContentViewCtrl', function ($scope) {
  })

.controller('SmallViewCtrl', function ($scope) {
  })

.controller('LargeViewCtrl', function ($scope) {
  });

在整个应用程序Plunker: http://plnkr.co/edit/yvtoUle0ZUWkSOmjlCoQ p = preVIEW 你可以输入这两个州的罚款第一次,而是试图返回到previously激活状态将会失败。

Plunker with the entire application: http://plnkr.co/edit/yvtoUle0ZUWkSOmjlCoQ?p=preview You can enter both states fine the first time, but trying to return to a previously activated state will fail.

我可能只是失去了一些东西,但我已经冲刷的例子interwebs,并试图许多变化,但一切我尝试在这种相同的行为结果。

I'm probably just missing something, but I've scoured the interwebs for examples and tried numerous variations, but everything I try results in this same behavior.

推荐答案

原来这是UI的路由器额外的错误:的 https://github.com/christopherthielen/ui-router-extras/issues/103 。还原到UI路由器v0.2.11(离开UI的路由器在额外v0.0.10)是一个临时的解决办法。

Turns out this is a bug in ui-router-extras: https://github.com/christopherthielen/ui-router-extras/issues/103. Reverting to ui-router v0.2.11 (and leaving ui-router-extras at v0.0.10) is a temporary fix.

UPDATE:这已经被固定在UI的路由器额外

UPDATE: This has since been fixed in ui-router-extras

这篇关于使用UI的路由器粘额外国家不能过渡到previously激活状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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