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

[$injector:unpr] Unknown provider: $ionicNativeTransitionsProvider #86

Open De-Lac opened 8 years ago

De-Lac commented 8 years ago

I got this very strange error.... Error: [$injector:unpr] Unknown provider: $ionicNativeTransitionsProviderProvider <- $ionicNativeTransitionsProvider I'v used ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.2

imported the ionic-native-transitions.min.js from github and put it in the index.html file

I added 'ionic-native-transitions' as dependency in app.js

angular.module('myapp.external', ['ionic-native-transitions']);
angular.module('myapp', ['myapp.external']);

but I got this error.... any idea? thank you

shprink commented 8 years ago

Make sure the ionic-native-transitions file is correctly injected in your app.

De-Lac commented 8 years ago

sorry, what do you mean? I have the .js file in my path, and imported it in .index.html. I use $ionicNativeTransitionsProvider only as directive and in state, as

.state('poi', { url: '/poi', templateUrl: 'templates/poi.html', nativeTransitions: { "type": "flip", "direction": "up" }, controller: 'descriptionPanelController', controllerAs: 'descCtrl' })

so I guess shouldn't inject it anywhere else.

shprink commented 8 years ago

missing $ionicNativeTransitionsProvider either means that the script is not injected in the page or that it is not added as a dependency.

Which version are you using?

De-Lac commented 8 years ago

ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.6.2

and the imported .js file says

/*!
 * ionic-native-transitions
 *  ---
 * Native transitions for Ionic applications
 * @version: v1.0.0-rc10
 * @author: shprink <contact@julienrenaux.fr>
 * @link: https://github.com/shprink/ionic-native-transitions
 * @license: MIT
 * 
 */

then in my app.js I have something like:

.config(function($ionicConfigProvider, $ionicNativeTransitionsProvider) {

  $ionicConfigProvider.views.transition('none');   
  $ionicNativeTransitionsProvider.enable(true);
 $ionicNativeTransitionsProvider.setDefaultOptions({ /* options */ });
De-Lac commented 8 years ago

it works... sorry, I was injecting '$ionicNativeTransitionsProvider' also in app.run(). I removed the dependency from .run() and now it works.

shailendramonu commented 8 years ago

I am also facing same issue when include $ionicNativeTransitionsProvider in config. All the default transition options are working fine without adding this provider but when trying to override and include it start giving unknown provider.

Using bower I have include ionic-native-transitions.js in index html Add 'ionic-native-transitions' in app js Transition works fine when add nativeTransitions in routes e.g.

.state('app.intro', {
        url: '/intro',
        nativeTransitions: {
          "type": "fade",
          "duration": "300"
        }
      })

Unknown provider error when

.config(function ($stateProvider, $urlRouterProvider, $ionicConfigProvider, $ionicNativeTransitionsProvider) {

Using ionic driftyco/ionic-bower#1.0.0

Any idea?