Reputation: 2244
I am a newbie to angular js . Here in my project i want to pass multiple parameters in anchor tag . So that i will get multiple params in address bar too. I have tried this one but its not working at all.
<a href="" ui-sref="edit_user({id:0,pid:'add-user'})">Add New user</a>
It is showing "http://localhost/Angular/#/edit-user/0",but i need to pass some more parameters. Above is the code. I want the url to be ""http://localhost/Angular/#/edit-user/0/add-user"," Here , am I doing anything wrong ? Please suggest me . Thank you.
Upvotes: 0
Views: 1226
Reputation: 1579
You can do that like :
$state.go('editUser', {id: 0, pid: 0});
// or In your view :
<a ui-sref="editUser({id:0,pid:0})">Add New user</a>
In your config :
$stateProvider
.state('editUser', {
url: '/edit-user?id&pid',
views: {
'': {
templateUrl: 'users.html',
controller: 'MainCtrl'
},
},
params: {
id: null,
pid: null
}
})
Upvotes: 1