r/angularjs • • Aug 28 '14

[Code] UI-Router 0.2.11 released

https://github.com/angular-ui/ui-router/releases/tag/0.2.11
42 Upvotes

16 comments sorted by

9

u/ctanga Aug 28 '14

New Feature Highlights:

  • Typed and optional state parameters

  • ui-sref-active now activates for all children states

  • ui-sref-active-eq new directive activates only for the exact state

2

u/enkideridu Aug 29 '14

extend syntax for ui-sref
add possibility to pass params to current state without entering state name

<a ui-sref="{page: 2}">Next page</a>

This is actually exactly what I needed. Thanks!

3

u/prettycode Aug 28 '14 edited Aug 28 '14

Can someone explain to me how this change makes sense? It is listed under "Features", subsection "$urlMatcherFactory".

Type.prototype.is() is hard-coded to always return "true", and Type.prototype.encode() simply returns the first argument passed in.

This is a head-scratcher for me.

4

u/ctanga Aug 29 '14

I haven't been involved with typed parameters, but I'm fairly certain Type is meant to be a basis for your custom-defined parameter type. You are supposed to make is() meaningful and encode() do something useful.

3

u/orbitur Aug 29 '14

Can they just make it part of angular-proper already?

2

u/jmcunningham Aug 29 '14

I thought the rumors were that it might become the official router in Angular 2.0? Anyone know whether that is true?

2

u/ctanga Aug 29 '14

Not true. Angular router 2.0 is a different project. Nate Abele and Tim Kindberg from ui-router were on the design committee but we are not involved beyond that. Incidentally, you can see their progress https://github.com/angular/router

2

u/badcookies Aug 29 '14

Pretty sure I read they wanted to back port it to 1.2 (3?) as well

1

u/[deleted] Aug 29 '14

This is awesome. Random q since there are ui router peeps here: Do any of you folks have good examples of oauth token auth with refresh tokens using ui router and localStorage?

1

u/ctanga Aug 29 '14

I've implemented JWT in a project but not oauth.

1

u/brianvaughn Aug 29 '14

This isn't a UI Router centric answer...but have you checked out satellizer? It could handle the auth portion of your question.

As for the UI Router portion, you might find something interest in a Gist I posted recently: https://gist.github.com/bvaughn/90343c06467e9bcb8d27

Specifically the section talking about the abstract 'authenticated' and its 'currentUser' resolve. I've used this approach a couple of times in the past and it's worked fairly well for me.

1

u/jetrii Aug 29 '14

looks like the links to the release (normal & minified) still points to 0.2.10.

2

u/ctanga Aug 29 '14

Thanks, I updated the github-pages site; should be good to go now.

3

u/brianvaughn Aug 28 '14

Woo hoo!

  • ui-sref-active now activates for all children states

  • ui-sref: cancel transition if preventDefault() has been called

1

u/aclave1 Aug 29 '14

I love ui-router! Keep up the great work guys, this is an incredible library.