Let not repeat ourselves ok?
<iframe src="//benschwarz.github.io/bower-badges/embed.html?pkgname=angular-named-routes" width="160" height="32" allowtransparency="true" frameborder="0" scrolling="0"></iframe>$ bower install angular-named-routes
In your routes
angular.module('yourModule', ['zj.namedRoutes'])
.config([
'$routeProvider',
'$locationProvider',
function($routeProvider, $locationProvider){
// use hashbang fallback mode
$locationProvider.hashPrefix("#!")
$locationProvider.html5Mode(false)
$routeProvider
.when('/products/:cat/:id', {
controller: 'OptionalController',
template: '/static/javascripts/application/templates/optional-template.html',
name: 'item-detail'
})
.otherwise({ redirectTo: "/" });
}]);
In your templtes
<a data-named-route='item-detail' data-kwarg-id='1' data-kwarg-cat='fish'>Salmon Info</a>
Should turn into :
<a href="#!/products/fish/1/">Salmon Info</a>
- setup nodejs and npm
- git clone this repo
$ npm install
Tests are in ./src/tests, still needs tests for filter and directive.
Inspired by a code snippet by g00fy @stackoverflow: