Hi Sander,
I could also write my own forEach and isUndefined in plain javascript. But
since AngularJS already does this they expose it through an API, and I
don't have to write it.
Given the test I mentioned slightly modified below, how would I use the
URLUtils inside the *someFunction *method to pass? It doesn't seem to have
any concept of route style parameters.
it('should interpolate a route with optional parameter excluded',
function(){
var searchRoute = "/search/:query/:limit?";
var url = *someFunction*(searchRoute, {query: 'foo'});
expect(url).toBe("/search/foo");
}
AngularJS's ngRoute does this work already (
https://github.com/angular/angular.js/blob/master/src/ngRoute/route.js#L631).
I was wondering if I could save myself writing the parser and interpolator
and the unit tests since they already have a working implementation
covering all the edge cases.
I want to pass one of the paths that I original passed to
$routeProvider.when(path, {...}) along with an object of parameters and get
a resulting URL which I could set in $location.path().
I have no problems on how to write the plain javascript to parse everything
the same way AngularJS does. But I was wondering if AngularJS exposed that
in any way, so I could just use theirs (and get test coverage, edge cases
and future improvements along with it for free).
Cheers,
Marc Fallows
[email protected]
On Mon, Oct 27, 2014 at 11:38 AM, Sander Elias <[email protected]>
wrote:
> Hi Marc,
>
> You can build an url using plain javascript
> <https://developer.mozilla.org/en-US/docs/Web/API/URL>, no need for
> angular to provide sugar over that.
>
> Regards
> Sander
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/bEX5Ateee98/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.