There are two ways to do this:
1 - $state
app.controller("fruitsCtrl", function ($scope, $state) {
$state.go('vegetables', {name:"carrot"});
$state.transitionTo('vegetables', {name:"carrot"});
});
2 - ui-sref
<nav>
<ul>
<li><a ui-sref="fruits({name: 'mango'})">Fruits</a></li>
<li><a ui-sref="vegetables({name: 'potato'})">Vegetables</a></li>
</ul>
</nav>
:
$stateProvider
.state('fruits', {
url:"/fruits/:name",
templateUrl: "views/fruits.html",
controller: "fruitsCtrl"
})
.state('vegetables', {
url:"/vegetables/:name",
templateUrl: "views/vegetables.html",
controller: "vegetablesCtrl"
});
!