ui-router icon indicating copy to clipboard operation
ui-router copied to clipboard

Cannot remove a state

Open bramslob opened this issue 12 years ago • 4 comments

Hey,

I am building an app with Ionic Framework which depends on ui-router for its routing. And the app has to be really dynamic, dynamic enough to flick a switch and a different menu structure should be usable.

What I need is a way to remove certain states (with the wrong HTML and/or controller), so I can add the correct new state(s) (with the right HTML and/or controller). Yet I see no way to do that in the current setting of ui-router.

Is there a way or is it something worth adding?

bramslob avatar Apr 16 '14 14:04 bramslob

This is definitely not officially supported. If you search around in the issues there is some lazy loading and editing of the states on the fly discussed, I just can't remember exactly where. Use at your own risk though.

timkindberg avatar Apr 18 '14 03:04 timkindberg

I researched the subject before I opened an issue, yet I could not find much information on the subject. Might be because I am looking with the wrong keywords.

Too bad it isn't somewhere in the code, it's really vital to my project. The only other way I could think of is to use a controller connected to the state, which retrieves the correct HTML and inserts it. But it seems kind of hack-y.

Am I really alone in wanting/needing this ? Ofcourse you are busy with perfecting this and other ui utilities, Keep up the good work

bramslob avatar Apr 18 '14 06:04 bramslob

After some digging I found a comment by you @timkindberg linking to https://github.com/angular-ui/ui-router/wiki#alternative-ways-to-set-the-template and using the templateProvider adequately solves my problem. So thanks for posting that (approx. 10 months ago)

bramslob avatar Apr 18 '14 09:04 bramslob

:)

timkindberg avatar Apr 18 '14 14:04 timkindberg