1

我对Android的离子型应用程序,我想用ngCordovaOauth插件添加Facebook的登录功能,但我得到:“ngCordovaOauth不可用”错误离子应用

0  851065 error Uncaught Error: [$injector:modulerr] Failed to instantiate module 
starter due to: 
Error: [$injector:modulerr] Failed to instantiate module ngCordovaOauth due to: 
Error: [$injector:nomod] Module 'ngCordovaOauth' 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. 
.... 

我尝试加载根据插件到here。我用亭子加载

bower install ng-cordova-oauth -S 

然后,我添加行至的index.html

<script src="lib/ng-cordova-oauth/dist/ng-cordova-oauth.min.js"></script> 

在此之后,插件,我添加的依赖于模块app.js

angular.module('starter', ['ionic','ngMessages','ngCordova','ngCordovaOauth','ksSwiper','starter.services','starter.controllers']) 

当我添加'ngCordovaOauth'时会出现错误。我也尝试手动文件下载NG-科尔多瓦 - oauth.min.js并将其添加到www/js的文件夹,并添加

<script src="js/ng-cordova-oauth.min.js"></script> 

的index.html文件后,我通过亭子卸载。这也没有奏效。我也尝试删除Android平台,并再次添加它,并没有工作。

我想我尝试了一切,我可以做但似乎不起作用。它应该找到ngCordovaOauth但它不。任何帮助表示赞赏。

在此先感谢。

编辑

的index.html:

<head> 
<meta charset="utf-8"> 
<meta http-equiv="Content-Security-Policy" content="default-src *; script-src &apos;self&apos; &apos;unsafe-inline&apos; &apos;unsafe-eval&apos; *; style-src &apos;self&apos; &apos;unsafe-inline&apos; *"> 
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
<title></title> 

<link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
<link href="lib/swiper/dist/css/swiper.min.css" rel="stylesheet"/> 
<link href="css/style.css" rel="stylesheet"> 

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
<link href="css/ionic.app.css" rel="stylesheet"> 
--> 

<!-- ionic/angularjs js --> 
<script src="lib/ionic/js/ionic.bundle.js"></script> 
<script src="lib/ngCordova/dist/ng-cordova.js"></script> 
<script src="lib/swiper/dist/js/swiper.js"></script> 
<script src="lib/angular-swiper/dist/angular-swiper.js"></script> 
<script src="js/angular-messages.js"></script> 
<script src="lib/ng-cordova-oauth/dist/ng-cordova-oauth.min.js"></script> 

<!-- cordova script (this will be a 404 during development) --> 
<script src="cordova.js"></script> 

<!-- your app's js --> 
<script src="js/app.js"></script> 
<script src="js/services.js"></script> 
<script src="js/controllers.js"></script> 

+0

你在哪里试图将脚本包含在index.html文件中? –

+0

我编辑了问题 – gkocyigit

+0

你安装了什么版本的ng-cordova? v0.1.24-alpha是修复了OAuth依赖性问题的版本。 –

回答

0

我有同样的错误消息,虽然我没有正确安装NG-科尔多瓦,OAuth的,我没有拼错名字。
我的问题是,我盲目地复制

<script src="../ng-cordova-oauth/dist/ng-cordova-oauth.min.js"></script> 

从纳克 - 科尔多瓦 - 的OAuth的README文件到我index.html,而路径是错误的!确实,正确的道路是你在你的问题中指定的道路:lib/ng-cordova-oauth/dist/ng-cordova-oauth.min.js
因此,对于任何有同样问题的人,我建议检查他们的ng-cordova-oauth.min.js的路径index.html

相关问题