You are almost there. Just the parameter must be part of the URL definition, not the name of the state:
.state('topics',{
url: '/{id:[0-9]{1,8}}', // we can also add some constraint, like int id only
templateUrl: "",
controller: ""
})
And how to call it (where currentItem.id
would be injected dynamically as a part of some ng-repeat)
<a ui-sref="topics({id:currentItem.id})">SomeText</a>
Because ui-sref
means: ui-sref='stateName({param: value, param: value})
. More info here: