You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I have a use-case whereby a button effectively opens and closes a form when clicked. The form that is opened is defined in a child state and is targeted through a relative ui-sref=".new". I've currently hacked this behaviour by creating the following directive.
I feel option 1 is the cleaner of the two from a user's perspective. I suspect option 2 is easier to realise/implement; I had a 2 line fix in ui-router for quite a while that realised this state toggle behaviour by checking whether the attribute 'ui-sref-toggle' was present.
Alternative
An alternative route to take would be to consider whether it's possible to make the ui-sref directive more extensible so that developers might be able to hook these type of use-cases into ui-router..? This would perhaps fit with nateabele's remark in issue #1863.
If you want to resubmit a separate PR that just factors out the uiSref link function into a controller, that'd be fine, too. Then you'll have a more flexible API for making directives that goes beyond what's available in the core if you need to do really specific stuff.
But I'm not sure whether that would work for this use-case - haven't gotten my head around it yet. Wanted to hear your thoughts first!
The text was updated successfully, but these errors were encountered:
Hey, sorry for the late feedback. Interesting concept, don't love the implementation. Again, as with other proposals elsewhere (including #1863), you're munging together two unrelated concerns. We could theoretically have thousands of these.
If you're interested in taking up the call for refactoring per my notes in the other issue, I'd be happy to guide you, and it'd probably get you a cleaner, more general solution in your own code.
Hi, I have a use-case whereby a button effectively opens and closes a form when clicked. The form that is opened is defined in a child state and is targeted through a relative ui-sref=".new". I've currently hacked this behaviour by creating the following directive.
I was wondering whether you would consider/be interested in a PR that would add this type of behaviour to ui-router?
API Options
I feel option 1 is the cleaner of the two from a user's perspective. I suspect option 2 is easier to realise/implement; I had a 2 line fix in ui-router for quite a while that realised this state toggle behaviour by checking whether the attribute 'ui-sref-toggle' was present.
Alternative
An alternative route to take would be to consider whether it's possible to make the ui-sref directive more extensible so that developers might be able to hook these type of use-cases into ui-router..? This would perhaps fit with nateabele's remark in issue #1863.
But I'm not sure whether that would work for this use-case - haven't gotten my head around it yet. Wanted to hear your thoughts first!
The text was updated successfully, but these errors were encountered: