在角度离子应用程序中添加原生过渡插件时出错

时间:2017-03-02 05:12:46

标签: javascript angularjs ionic-framework

尝试向我的应用添加原生过渡,但收到错误“错误:[$ injector:nomod]模块'ionic-native-transitions'不可用!您错误拼写了模块名称或忘记加载它。如果注册了模块确保您将依赖项指定为第二个参数。“我已正确添加了依赖项。任何领导都将不胜感激。谢谢提前:)

App.js

angular.module('starter', ['ionic','ionic-native-transitions','starter.controllers'])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function($window) {
 if(window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})
 .config(function($stateProvider,$ionicNativeTransitionsProvider,$urlRouterProvider,$ionicConfigProvider) {
.state('chat', {
      url: '/chat',
      nativeTransitions: {
        "type": "flip",
        "direction": "up"
    }, 
      templateUrl: 'templates/chat.html',

  })

HTML

 <div ui-sref="chat"  class="title" >
    <a  class="underline" ui-sref="chat"  native-transitions>
      <img class = "title-image" src="img/Chat@1x.png"></img>
          <p class="imgtext" style="color: rgb(102, 0, 0)">Chat</p>
    </a><br>
 </div>

1 个答案:

答案 0 :(得分:0)

您需要将dist脚本包含在您的页面中。如果你使用commonjs a 简单的要求会做。如果不包含带有插件路径的de script标签 在你的页面

<script src="/your/path/ionic-native-transitions.js"><script>