I use ui-router, which exposes ui-sref in the HTML side
(ui-sref="app.search({query: 'foo', sort: 'asc'})" converts into an
appropriate a href or onclick if it's not in an anchor element) and
$state.go on the controller side which works more or less the same way.
Dunno if the basic router does that, but ui-router is pretty rad in general.

On Fri Oct 24 2014 at 9:14:29 AM Marc Fallows <[email protected]> wrote:

> Is the route interpolation exposed anywhere? It seem fairly hidden, but
> would be a useful thing to take advantage of so I don't have to rewrite the
> logic on my end.
>
> For example say I want to have the following in my controller:
>
> var searchRoute = "/search/:query/:sort?/:limit?";
>
> $scope.goToSearch = function(opts){
>    // opts could be {query: 'foo', limit: 10}
>
>    var url = $route.interpolate(searchRoute, opts);
>    $location.path(url);
> };
>
> Obviously $route.interpolate doesn't exist. Is there something that exists
> which could do this?
>
> Otherwise I have to interpolate that searchRoute myself, which seems silly
> given that Angular already does this.
>
>  --
> 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 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.

Reply via email to