Comments (7)
deepStateRedirect can now be a function.
I haven't added tests yet. I built off the dev branch if you want to try this:
https://gist.github.com/christopherthielen/40d33f98ddf2e4ffde04
example:
$stateProvider.state({
sticky: true,
deepStateRedirect: function($state) { return !$state.includes(this.name); },
from ui-router-extras.
Awesome thanks. I'll give this a shot soon.
from ui-router-extras.
I am facing the exact problem as jeverden mentioned. I am using deepStateRedirect. Just added breadcrumbs to my states and clicking the parent breadcrumbs from the child state/view won't return back to the parent state/view. How's the deepStateRedirect function going to help in this situation?
from ui-router-extras.
Ah, I think I got it. Added this to the parent state: deepStateRedirect: function($state) { return !$state.includes(parent_state_name); }, Not fully understand how it works though. :)
Another thing, it seems that I have use the dot notation for the deepStateRedirect to work, it won't work if I use the parent attribute instead of the dot notation.
from ui-router-extras.
I want to use this feature as well, but have the following situation:
- Tab clicked first time -> go to default state "feed"
- Tab clicked later on again -> dsr to the last active state
- Tab clicked twice -> go to default state "feed"
When using the dsr object for the definition there is a property "default" to set a default state but how can I realise this using a dsr function for the definition?
from ui-router-extras.
I got it running by adapting the example of the homepage
deepStateRedirect: {
default: { state: "foo.bar.baz.defaultSubState", params: { defaultStateParam1: "99" } },
params: true,
fn: function($dsr$) {
var shouldRedirect = // TODO finish docs;
}
}
In this example the current state was missing to be able to realise my use case (since
deepStateRedirect: {
default: { state: 'home.feed.list' },
fn: function($state) {
return $state.includes('home.feed.*') ? {state: 'home.feed.list'} : true;
}
}
from ui-router-extras.
Hi, I did as mentioned with my tabbed app
$stateProvider.state({
sticky: true,
deepStateRedirect: function($state) { return !$state.includes(this.name); },
and it works so that I can go back from the sticky state substate (child) back to the stick state (parent), however, it introduces another bug. As soon as click on the sticky states' tab I get the following error:
RangeError: Maximum call stack size exceeded
at Object.extend (angular.js:455)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)
at $injector.invoke (ct-ui-router-extras.js:1662)(anonymous function) @ angular.js:12221(anonymous function) @ angular.js:9055Scope.$broadcast @ angular.js:16040transitionTo @ angular-ui-router.js:3229$state.transitionTo @ ct-ui-router-extras.js:208$state.transitionTo @ ct-ui-router-extras.js:1713$state.transitionTo @ ct-ui-router-extras.js:1191go @ angular-ui-router.js:3068(anonymous function) @ ct-ui-router-extras.js:312Scope.$broadcast @ angular.js:16038transitionTo @ angular-ui-router.js:3229$state.transitionTo @ ct-ui-router-extras.js:208$state.transitionTo @ ct-ui-router-extras.js:1713$state.transitionTo @ ct-ui-router-extras.js:1191go @ angular-ui-router.js:3068(anonymous function) @ ct-ui-router-extras.js:312Scope.$broadcast @ angular.js:16038transitionTo @ angular-ui-router.js:3229$state.transitionTo @ ct-ui-router-extras.js:208 ...
any thoughts on how to solve that?
from ui-router-extras.
Related Issues (20)
- console.table is undefined in IE 11
- Exact url match instead of everything that follows HOT 1
- how to preload states - revisited HOT 1
- Cant get StateFactory to work the right way
- the params of "$previousState.set()" HOT 1
- $state.go is not working on ui-router 1.0.0-rc.1 for FutureState
- Error when importing ui-router-extras into app
- State change with "notify: false" refreshes sticky on next transition
- How to switch to a child state without losing hidden params? HOT 1
- End of Life, UI-Router v1.x and $previousState HOT 11
- Angular 1.6.5 Cannot read property '$$equals' of undefined HOT 4
- error : extend is not a function, injecting ct.ui.router.extras HOT 1
- Router doesn't resolve the child scope after the application is idle for at least 10 mins
- DSR Navigation not correctly stopped
- Sticky not working and routing failed after updating angular-ui-router @v1.0.15
- Error: [$injector:modulerr] Failed to instantiate module undefined due to: Error: [ng:areq] Argument 'fn' is not a function, got undefined
- Controller reloaded when params in route HOT 2
- $previousState is lost in case of page refresh
- DSR using params subset redirecting to the default state HOT 2
- Modules not loading after updating ui-router and angular 1.3 to 1.5.5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ui-router-extras.