shprink / ionic-native-transitions

[Maintenance only] Native transitions (iOS & Android) for Ionic Framework
https://www.npmjs.com/package/ionic-native-transitions
MIT License
572 stars 112 forks source link

StateParams with native-ui-sref #35

Open vandervidi opened 8 years ago

vandervidi commented 8 years ago

Hi When linking another with stateParams, i get an error like: "Could not resolve 'state.name({param1: data1, param2: data2})' from state 'someState'"

The transition works well without the stateParams.

tested it with the ui-router directive ui-sref attribute with stateParams and it works well as expected. Is it possible to pass stateParams using the native-ui-sref directive?

shprink commented 8 years ago

You mya use {inherit:false} option.

native-ui-sref="tabs.home" native-ui-sref-opts="{inherit:false}"

https://github.com/shprink/ionic-native-transitions#using-directives

or

$ionicNativeTransitions.stateGo('yourState', {inherit:false}, {
    "type": "slide",
    "direction": "up", // 'left|right|up|down', default 'left' (which is like 'next')
    "duration": 1500, // in milliseconds (ms), default 400
});

https://github.com/shprink/ionic-native-transitions#state

iamsamwood commented 8 years ago

I'm hitting this as well--I see state options being passed, but not state params. Is there a way to pass state params with native transitions ?

shprink commented 8 years ago

$ionicNativeTransitions.stateGo('yourState', <stateParams>) same as $state.go('yourState', <stateParams>)

iamsamwood commented 8 years ago

ui-router $state.go takes 3 arguments, stateName, stateParams, stateOptions [1], but it seems that $ionicNativeTransitions.stateGo only takes stateParams as the second argument, while "native-ui-sref-opts" takes stateOptions. Is this correct? Thanks.

[1] http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#go

shprink commented 8 years ago

You are right. My mistake!

shprink commented 8 years ago

@iamsamwood please try rc8

the api changed to: https://github.com/shprink/ionic-native-transitions#state

iamsamwood commented 8 years ago

@shprink OK thanks. Does ui-sref-opts need to be updated for this change as well ?https://github.com/shprink/ionic-native-transitions/blob/develop/lib/nativeSref.js

shprink commented 8 years ago

Once again you are right!

shprink commented 8 years ago

Fixed in v1.0.0-rc9