Skip to content

Add regexp matching for route to element transformers - #1430

Merged
bostrom merged 3 commits into
mgonto:masterfrom
bostrom:regex-elem-transformer
Dec 25, 2016
Merged

bostrom merged 3 commits into
mgonto:masterfrom
bostrom:regex-elem-transformer

Conversation

@bostrom

@bostrom bostrom commented Oct 17, 2016

Copy link
Copy Markdown
Collaborator

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

bostrom commented Oct 17, 2016

Copy link
Copy Markdown
Collaborator Author

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