我正面临
的错误[$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module ngCordova due to:
现在我知道这与索引html无法以某种方式引用ngcordova服务有关。
的index.html
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-messages.js"></script>
<script src="lib/ionic-material/dist/ionic.material.min.js"></script>
<script src="lib/chart.js/dist/Chart.min.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script type="lib/ngCordova/dist/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<script type="lib/ng-cordova-oauth/dist/ng-cordova-oauth.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
现在,&#34; lib / ngCordova / dist / ng-cordova.min.js&#34;已经存在了。我很确定这是一个简单的错误。但仍然想弄清楚一样。
app.js
var app = angular.module('starter', ['ionic', 'ionic-material','ngMessages', 'ngCordova']);
答案 0 :(得分:0)
编辑:类型 - &gt;的 SRC 强>
而不是
<script type="lib/ngCordova/dist/ng-cordova.js"></script>
<script type="lib/ng-cordova-oauth/dist/ng-cordova-oauth.js"></script>
使用
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="lib/ng-cordova-oauth/dist/ng-cordova-oauth.js"></script>
<小时/> 在app.js中将 ngCordova 作为Angular依赖项注入
angular.module('myApp', ['ngCordova'])