State Params not working in Ionic 1.3.1


#1

Hello everyone,
i updated our app from Ionic 1.2.4 to Ionic 1.3.1 yesterday. Since then state params aren’t working properly anymore. Was this changed somehow in 1.3.1? I wasn’t able to find anything online?
The code:
<div class="swapsClick" ui-sref="swap({swapId: otherItem.swapId})"></div>

 $stateProvider
            .state('swap', {
                url: '/swap',
                cache: false,
                params: {
                    swapId: null
                },
                views: {
                    'main': {
                        templateUrl: 'app/swap/swap.html',
                        controller: 'SwapController as SwapCtrl'
                    }
                }
            });

I’m now nomore able to read out the stateparams in the controller , like i was before.
Any ideas?

Thank You!


#2

I’m just trying to use this feature for the first time and cannot make it work. I’m using ionic 1.3.1. Following your topic…

Edit: downgraded to ionic V1.2.4 and now works


#3

I did that too, but that’s not a solution, that’s just a workaround. :wink:


#4

Yes, was a workaround.
Kept on researching and found out that i had problems with the scope concept: my ui-sref was inside a ng-repeat over an updatable array. That produced weird behaviour after updating the array.
Instead of writing out ui-sref, called a function with the $index used to traverse the array and in that function use $state.go to navigate. The params set in state.go were set OK in the target stateParams (in v 1.3.1 too).