ionic-native-transitions icon indicating copy to clipboard operation
ionic-native-transitions copied to clipboard

[$injector:unpr] Unknown provider: $ionicNativeTransitionsProvider

Open De-Lac opened this issue 8 years ago • 6 comments

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

De-Lac avatar Apr 04 '16 12:04 De-Lac

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

shprink avatar Apr 04 '16 12:04 shprink

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.

De-Lac avatar Apr 04 '16 12:04 De-Lac

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?

shprink avatar Apr 04 '16 12:04 shprink

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 <[email protected]>
 * @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 avatar Apr 04 '16 13:04 De-Lac

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

De-Lac avatar Apr 04 '16 14:04 De-Lac

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?

shailendramonu avatar Sep 26 '16 01:09 shailendramonu