如何将插件添加到我的 Ionic 项目中?
How do I add plugins to my Ionic project?
我正尝试按照页面上列出的说明将 ionic-native-transitions 添加到我的应用程序。他们在线的步骤:
凉亭
bower install shprink/ionic-native-transitions
Ionic CLI
Ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.5.4`
配置
angular.module('yourApp', [
'ionic-native-transitions'
]);
这是一切都崩溃的地方,我收到以下错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module
yourApp due to: Error: [$injector:modulerr] Failed to instantiate module
ionic-native-transitions due to: Error: [$injector:nomod] Module
'ionic-native-transitions' is not available! You either misspelled the
module name or forgot to load it. If registering a module ensure that
you specify the dependencies as the second argument.
我是不是漏了什么地方?即使它是非常明显的东西,例如必须向我的 index.html
?
添加内容
您需要将脚本添加到您的 index.html
文件中。
<script type="text/javascript" src="path-to-ionic-native-transitions.min.js"></script>
我已经在我的一个项目中使用过这个插件并且效果很好,
使用命令添加 ionic-native-transitions插件,
cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions
此插件包含许多用于更改视图过渡的动画样式(向上、翻转、滑动、淡入淡出、抽屉等)。
请参考这个tutorial
如果你有任何 doubt.Please 告诉我?谢谢
嗨,我遇到了完全相同的问题,出于某些原因...
1/ 我已经使用 bower install shprink/ionic-native-transitions --save 在我的项目中安装了 lib
2/ 包含在我的 index.html 文件中
3/ 在我的 routes.js 文件中包含要求
4/ cordova 插件是否添加 https://github.com/Telerik-Verified-Plugins/NativePageTransitions
但最后我得到:nativepagetransitions is disabled or nativepagetransitions plugin is not present
我遇到了同样的问题。了解您是否使用脚手架工具非常重要(我使用的是 generator-ionic-gulp)。最近他们更改了编译过程的 "the way",请参阅此 link(第 2 点)。
https://www.npmjs.com/package/generator-ionic-gulp#development-mode
之前,最终 vendor.js 文件(包含所有依赖项)的导出来自 vendor.json,现在来自 bower.json。因此,为了正常工作,您必须更新该文件 :)
我正尝试按照页面上列出的说明将 ionic-native-transitions 添加到我的应用程序。他们在线的步骤:
凉亭
bower install shprink/ionic-native-transitions
Ionic CLI
Ionic plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions#0.5.4`
配置
angular.module('yourApp', [
'ionic-native-transitions'
]);
这是一切都崩溃的地方,我收到以下错误:
Uncaught Error: [$injector:modulerr] Failed to instantiate module yourApp due to: Error: [$injector:modulerr] Failed to instantiate module ionic-native-transitions due to: Error: [$injector:nomod] Module 'ionic-native-transitions' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
我是不是漏了什么地方?即使它是非常明显的东西,例如必须向我的 index.html
?
您需要将脚本添加到您的 index.html
文件中。
<script type="text/javascript" src="path-to-ionic-native-transitions.min.js"></script>
我已经在我的一个项目中使用过这个插件并且效果很好,
使用命令添加 ionic-native-transitions插件,
cordova plugin add https://github.com/Telerik-Verified-Plugins/NativePageTransitions
此插件包含许多用于更改视图过渡的动画样式(向上、翻转、滑动、淡入淡出、抽屉等)。
请参考这个tutorial
如果你有任何 doubt.Please 告诉我?谢谢
嗨,我遇到了完全相同的问题,出于某些原因... 1/ 我已经使用 bower install shprink/ionic-native-transitions --save 在我的项目中安装了 lib 2/ 包含在我的 index.html 文件中 3/ 在我的 routes.js 文件中包含要求 4/ cordova 插件是否添加 https://github.com/Telerik-Verified-Plugins/NativePageTransitions
但最后我得到:nativepagetransitions is disabled or nativepagetransitions plugin is not present
我遇到了同样的问题。了解您是否使用脚手架工具非常重要(我使用的是 generator-ionic-gulp)。最近他们更改了编译过程的 "the way",请参阅此 link(第 2 点)。 https://www.npmjs.com/package/generator-ionic-gulp#development-mode
之前,最终 vendor.js 文件(包含所有依赖项)的导出来自 vendor.json,现在来自 bower.json。因此,为了正常工作,您必须更新该文件 :)