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

Use multiple classes in ui-sref-active

Open bampakoa opened this issue 10 years ago • 10 comments

Hi,

When I use multiple classes in an ui-sref-active directive I get the following error in console:

[$parse:syntax] Syntax Error: Token 'class2' is an unexpected token at column 8 of the expression [class1 class2] starting at [class2].

AngularJS version: 1.3.20 UI-Router version: 0.2.16 Provided plunker: http://plnkr.co/edit/4y0KC38Vlnc57wy6owW9

bampakoa avatar Jan 25 '16 15:01 bampakoa

+1 This bug is kicking my ass right now.

I checked the documentation and this still looks like it should work:

http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-sref-active

[edit] It seems to be the $scope.$eval added in the following commit.

kmcarpenter avatar Jan 25 '16 16:01 kmcarpenter

Wow, this looks like a legit regression. Sorry about that. Thanks for the report, I'll patch it up shortly.

nateabele avatar Jan 25 '16 16:01 nateabele

I've been working on a simple fix. A try/catch around the $scope.$eval will work. Was just about to write a test and submit a PR.

working code

kmcarpenter avatar Jan 25 '16 17:01 kmcarpenter

Hah, that's basically what I just did. If you beat me to it, great. :smile:

nateabele avatar Jan 25 '16 17:01 nateabele

PR Submitted. Feel free to do with it as you wish :smile:

kmcarpenter avatar Jan 25 '16 17:01 kmcarpenter

Merged. I'll push a release shortly.

nateabele avatar Jan 25 '16 17:01 nateabele

Done: https://github.com/angular-ui/ui-router/releases/tag/0.2.17

nateabele avatar Jan 25 '16 17:01 nateabele

Amazing. Thanks for the quick turnaround.

kmcarpenter avatar Jan 25 '16 17:01 kmcarpenter

Happy to help. :smile:

nateabele avatar Jan 25 '16 20:01 nateabele

@kmcarpenter could you please submit a PR for this one for 1.0.0alpha0 as well? It has the same issue, if you can't I'll do it. Thanks!

fpipita avatar Feb 17 '16 08:02 fpipita