Angularjs, Use A Function In The Routing As The Templateurl
It's possible to use a function as the templateUrl. The official documentation for $routeProvider states: templateUrl – {string=|function()=} $routeProvider official documenta
Solution 1:
.when('/:storeId/private', {
templateUrl: function(params) {return'webPages/Stores' + params.storeId;},
controller: 'storeParseData'
})
Solution 2:
.when('/Store/:StoreId', {
templateUrl: 'path/to/your/template/index.html',
controller: 'MyController'
})
Then in MyController
to read the parameter do
$scope.store_id = $routeParams.storeId;
Post a Comment for "Angularjs, Use A Function In The Routing As The Templateurl"