0

I have a parent state called 'results' and two child states 'results.grid' and 'results.list'.

.state('results', {
            url: '/results',
            templateUrl: 'html/main_listing.html',
            redirectTo: 'results.grid'
        })
        //Child state for results state
        .state('results.grid', {
            templateUrl: 'html/grid_listing.html'
        })
       //Child state for results state
        .state('results.list', {
            templateUrl: 'html/list_listing.html'
        })

main_listing.html has

<a ui-sref="results.grid">Grid</a>
<a ui-sref="results.list">List</a>
<div ui-view></div>

I have used redirectTo and $stateChangeStart to load 'results.grid' by default when 'results' is loaded as given by the accepted answer in this question - ui-router default child state not working.

This works perfectly fine. But when I am on 'results.list' and I reload the page, it does not remain in 'results.list', it gets redirected to 'results.grid'.

How can I prevent this behaviour?

PCK
  • 1,254
  • 6
  • 20
  • 37
  • did check this [one](https://stackoverflow.com/questions/35961740/ui-router-state-redirecting-to-first-child-on-page-refresh) – Ulug Toprak Jul 19 '17 at 10:35
  • I am not using md-tabs. So, I don't think this solution works for me. – PCK Jul 19 '17 at 10:41

0 Answers0