Can't go to pre-activated state with ui-router-extras Sticky State
Using ui-router-extras
Sticky State (concurrent states) and Deep State Redirect according to http://christopherthielen.github.io/ui-router-extras/#/sticky , I cannot navigate to which 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
'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 with the entire application: http://plnkr.co/edit/yvtoUle0ZUWkSOmjlCoQ?p=preview You can enter both states the first time, but you will not be able to try to return to the previously activated state.
I was probably just missing something, but I looked at interwebs for examples and tried many variations, but everything I try to get it results in the same behavior.
source to share
It 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 exiting ui-router-extras in v0.0.10) is a temporary fix.
UPDATE: This has since been fixed in ui-router-extras
source to share