Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regexp matching for route to element transformers #1430

Merged
merged 3 commits into from
Dec 25, 2016

Conversation

bostrom
Copy link
Collaborator

@bostrom bostrom commented Oct 17, 2016

As one possible solution to #1289 (but also as a useful feature in itself), I added regexp matching for the route parameter in addElementTransformer.

If the route is given as a regexp /route/ to addElementTransformer, then the transformer function is stored in a separate transformers array along with its "matcher". When transforming elements, the regexp transformer array is first iterated to check which transformers match the current route and execute those. After that, it goes on as normal.

@bostrom
Copy link
Collaborator Author

bostrom commented Oct 17, 2016

As a side not, I couldn't get the tests to run on PhantomJS. I got this error:

Running "karma:build" (karma) task
17 10 2016 17:10:51.639:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
17 10 2016 17:10:51.650:INFO [launcher]: Starting browser PhantomJS
17 10 2016 17:10:53.601:INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket XhNbgIpgJQtwpb7vAAAA with id 65452568
PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  TypeError: 'undefined' is not an object (evaluating 'angular.module')
  at /Users/bostrom/Projects/restangular/src/restangular.js:13

Seems that angular isn't loaded on the window object when restangular is loaded...

@bostrom bostrom merged commit de8f561 into mgonto:master Dec 25, 2016
@bostrom bostrom deleted the regex-elem-transformer branch December 25, 2016 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant