ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: Params don't get passed correctly with $state.go()

Open ssreekanth opened this issue 11 years ago • 2 comments

Type: bug

Platform: all

$state.go(state, params) doesn’t seem to be passing the params correctly.

http://codepen.io/ssreekanth/pen/jEQLOa

Let me show it in my example here. Try to add grocery items to the shopping list.

  1. Click on ‘+’ at the top right corner. This will take you to the ‘Add Grocery’ view.
  2. Tap on ‘Milk’. It will take you to the ‘Grocery Details’ view.
  3. In Grocery Details view, you would see ‘Milk’. Now, click on ‘Add to Shopping List’ button. Milk gets added to the list and view transitions to ‘Shopping List’ page.

So far, it is fine.

  1. Now, try to add a new item to the list. Again click on ‘+’
  2. But, this time, tap on ‘Bread’.
  3. However, in the ‘grocery details’ view, it still shows ‘Milk’. It was supposed to show ‘Bread’.

ssreekanth avatar Mar 16 '15 23:03 ssreekanth

The problem appears to be the use of params and a url in your state configs. The doc for params says they are not allowed to be used at the same time.

I was able to get your codepen to work with a few tweaks.

Might I also recommend using ui-sref='app.grocerydetails({ grocery: item })' instead of the ng-click

agnellvj avatar Mar 17 '15 07:03 agnellvj

@agnellvj Thank you. That resolved my issue.

'ui-sref' may not help, if you want to handle some task before transitioning to the new state. With ng-click(), you can achieve it. Suggest me if therez a better way to handle this.

ssreekanth avatar Mar 17 '15 17:03 ssreekanth

Sreekanth

http://control-intern-managerial.ro/forex4you-minimalnym

17.03.2015, 20:46, "Sreekanth S" [email protected]:Closed .

—Reply to this email directly or .

Fayozjon avatar Mar 25 '15 00:03 Fayozjon