I may be missing what you guys are suggesting. What I want is to be able to
build the route, not find out the route parameters on the current route.
If $route.interpolate existed I would expect the tests below to pass.
Angular already has an interpolate in ngRoute. I can copy theirs, or write
my own, but ideally I would use their existing one. As far as I can tell
it's not exposed, but I'm hoping I'm wrong.
it('should interpolate a route', function(){
var searchRoute = "/search/:query/:limit?";
var url = $route.interpolate(searchRoute, {query: 'foo', limit: 10});
expect(url).toBe("/search/foo/10");
}
it('should interpolate a route with optional parameter excluded',
function(){
var searchRoute = "/search/:query/:limit?";
var url = $route.interpolate(searchRoute, {query: 'foo'});
expect(url).toBe("/search/foo");
}
Cheers,
Marc Fallows
[email protected]
On Mon, Oct 27, 2014 at 1:03 AM, Witold Szczerba <[email protected]>
wrote:
> As Sander said, the $routeParams is the missing service :-)
>
> Regards,
> Witold Szczerba
> 25 paź 2014 07:30 "Sander Elias" <[email protected]> napisał(a):
>
>> Hi Marc,
>>
>> As I just said somewhere else, I'm still a bit groggy from ngEurope. So I
>> might have missed a point in your question.
>> can't you just inject $routeParams
>> <https://docs.angularjs.org/api/ngRoute/service/$routeParams> into your
>> controller/whatever where you need this?
>>
>> Regards
>> Sander
>>
>> --
>> 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.
>>
> --
> 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.