Here is the code that I am using currently:
in view:
<a ui-sref="restaurantDetail({ type: {{restaurant.type}} })" >{{restaurant.name}}</a>
In route,
.state('restaurantDetail', {
url: '/restaurantDetail/:type',
templateUrl: 'templates/restaurantDetail.html',
controller : 'restaurantDetailCtrl'
})
In controller:
.controller('restaurantDetailCtrl', function($scope,$http,Base_URL,$state, $stateParams) {
console.log($stateParams); //returns Object type:""
console.log($stateParams.type); //returns undefined
});
It should generate the URL restaurantDetail/type but it is returning restaurantDetail
I don't know where the issue is? I just need to pass the variable within url using $stateProvider