routing - How to create AngularJS Route with dashes instead of slashes -
routing - How to create AngularJS Route with dashes instead of slashes -
is possible create angular routes dashes instead of slashes, , variable content in url fragment? example:
in angular phone tutorial, urls this, e.g:
http://angular.github.io/angular-phonecat/step-11/app/#/phones/motorola-xoom
this implemented via route provider such as:
when('/phones/:phoneid', { templateurl: 'partials/phone-detail.html', controller: 'phonedetailctrl' })
what i'd have urls more like:
http://angular.github.io/angular-phonecat/step-11/app/#/phones/{{manufacturer}}--{{devicename}}--{{phoneid}}
where {{phoneid}} numerical database key , {{manufacturer}} text vary phone phone. because need numerical key drive database want manufacturer & devicename text (or equivalent) in url seo purposes....
effectively i'd in angular routes can in htaccess files, i'd like: rewriterule ^(.)--by--(.)--(.*)$ phone.php?mfg=$1&devicename=$2&phoneid=$3
i know angular routes don't back upwards wildcards this, wondering how might able accomplish effect this. or maybe there extension enables this?
you can utilize variable using :name in url (source)
in config:
config(function($routeprovider, $locationprovider) { $routeprovider .when('/phones/:manufacturer--:devicename--:phoneid', { templateurl: 'file.html', controller: 'phonecontroller' });
to access parameters in controller:
$routeparams.manufacturer $routeparams.devicename $routeparams.phoneid
angularjs routing angular-routing
Comments
Post a Comment