Harish Harish - 2 years ago 98
AngularJS Question

ui sref not working properly

I'm using angular ui router and routing my pages, here my main page is contracts.html

I want to route to another page from this page hence I have written the following code. But it is not working, please take a look at the following code :

<li role="menuitem"><a ui-sref=".monthlysettings" onclick="$('#simple-btn-keyboard-nav2').text('PDC Settings')">PDC Settings</a></li>




.state('contracts', {
url: '/contracts',
controller: 'contractsController',
templateUrl: 'contracts.html'
}).state('contracts.monthlysettings', {
url: '/monthlysettings',
controller: 'monthlysettingsController',
templateUrl: 'monthlysettings.html'
})

Answer Source

Your state name should be the full name contracts.monthlysettings

<li role="menuitem"><a ui-sref="contracts.monthlysettings" onclick="$('#simple-btn-keyboard-nav2').text('PDC Settings')">PDC Settings</a></li>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download