angularjs - Build URLs based on routes -
angularjs - Build URLs based on routes -
is there way build url based on defined angular routes? symfony (http://symfony.com/doc/current/book/routing.html#generating-urls).
here illustration of how used:
app.config(['$routeprovider', function($routeprovider) { $routeprovider .when('/document/:documentid', { name: 'document', templateurl: 'partials/document.html', controller: 'documentcontroller' }); }]);
then in templates utilize like:
<a href="{ $router.build('document', {documentid: 4567}) }">view document</a>
that compiled into:
<a href="/document/4567">view document</a>
i have user $stateparams (from angular-ui-router) this.
.controller('mainctrl', function ($scope, $stateparams) { $scope.link = $stateparams.documentid; });
ui router wiki on github
angularjs url
Comments
Post a Comment