简单错误 - 检查其他帖子 - ngCordova 未定义
Simple Error - Checked other posts - ngCordova not defined
我正面临这个错误
[$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>
现在,"lib/ngCordova/dist/ng-cordova.min.js" 已经存在。我非常确定这是一个简单的错误。但仍在努力弄清楚。
app.js
var app = angular.module('starter', ['ionic', 'ionic-material','ngMessages', 'ngCordova']);
编辑:type -> 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>
将 ngCordova 作为 Angular 依赖项注入 app.js
angular.module('myApp', ['ngCordova'])
我正面临这个错误
[$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>
现在,"lib/ngCordova/dist/ng-cordova.min.js" 已经存在。我非常确定这是一个简单的错误。但仍在努力弄清楚。
app.js
var app = angular.module('starter', ['ionic', 'ionic-material','ngMessages', 'ngCordova']);
编辑:type -> 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>
将 ngCordova 作为 Angular 依赖项注入 app.js
angular.module('myApp', ['ngCordova'])