christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

Support for Ui-Router 0.2.15 #234

Closed crediblebytes closed 9 years ago

crediblebytes commented 9 years ago

The latest ui-router contains some much needed fixes like reloadOnSearch https://github.com/angular-ui/ui-router/releases

christopherthielen commented 9 years ago

What features don't work with 0.2.15?

crediblebytes commented 9 years ago

I haven't found any yet just would be nice to have the official OK before moving into production.

christopherthielen commented 9 years ago

Extras should work with 0.2.15. :+1:

anzorb commented 8 years ago

I can't seem to get reloadOnSearch to work correctly with sticky states. I have 2 tabs, each backed by its own controller.

I need to be able to pass some params/search vars from step1 to step2, without reloading the controller.

When using sticky states and a search string or param in the URL, reloadOnSearch is ignored and controller is destroyed and re-instantiated when the tab becomes visible again. Here's a plunker showing this behaviour: http://plnkr.co/edit/JOrtqK2EGOZxhO3cmRie?p=preview (check the console)

Removing the ?update search param from the state stops it from re-instantiating, but I feel passing around params without re-instantiating the view would be the whole point of reloadOnSearch + ui-router-extras.

According to my research, searchOnReload behaves correctly now, here's a related plunker: http://plnkr.co/edit/5OPoKUDnn98JiKFlyEYL?p=preview

$stateProvider
    .state('tab1', {
      url: '/tab1',
      sticky: true,
      views: {
        tab1: {
          controller: 'Tab1Ctrl',
          templateUrl: 'tab1.html'
        }
      }
    })
    .state('tab2', {
      url: '/tab2?update',
      sticky: true,
      reloadOnSearch: false,
      views: {
        tab2: {
          controller: 'Tab2Ctrl',
          templateUrl: 'tab2.html'
        }
      }
    });

PS: Same behaviour is observed when using :param instead of search string. @christopherthielen, should I move this into its own issue?

christopherthielen commented 8 years ago

@anzorb yes, if reloadOnSearch is broken, there should be a separate ticket opened.