How to pass URL parameters through templateUrl in AngularJS?
angularjs, javascript
Solution
Thanks guys,this is what I wanted
.when('/expression/:expressionId/type/:typeId', {
templateUrl: function(params) {
return '/sort/' + params.expressionId +'/'+ params.typeId ;
},
controller: 'tasksController'
});
Problem
Trying to learn AngulareJS got stuck with this. This is the code : ``` app.config(function ($routeProvider){ $routeProvider .when('/', { templateUrl: '/sort', controller : 'tasksController' }) .when('/expression/:expressionId/type/:typeId', { templateUrl: '/sort/'+:expressionId +'/'+ :typeId, controller : 'tasksController' })}); ``` This is obviously wrong. Can any one please tell me what is the correct way to do this? Thanks.