How to use state.go instead of href?

Hello
I am using href="#/tab/locations/" .But I want to user $state.go(’’);
I have used $state.go(’/tab.locations’);. But it is not working.

Please help me

Pass the state name, not the url.

Yes you can do it like encodedmirko said, but i had some issues with backview and i came up with diy solution i created a service to go to states and store the last views and works pretty well using localforage as history storage .

Hello encodedmirko,
How to do it?

Please helpe me…

your state:

.state('myState', {
   url: '/myState/:param1'
   ....
});

then you need do it so in your controller:

$state.go('myState', {
  param1: 'myParam1Value'
});

in your templates use ui-sref:

<a ui-sref="myState({
  param1: 'myParam1Value'
})">GoTo myState</a>