gpt4 book ai didi

javascript - 错误: [$injector:unpr] Unknown provider: RequestsServiceProvider <- RequestsService http://errors. angularjs.org/1.3.13/

转载 作者:行者123 更新时间:2023-12-02 15:17:34 25 4
gpt4 key购买 nike

尽管将我的服务名称定义为所有必要的宫殿,但我还是遇到了上述错误。

这是我的 app.js

var app = angular.module('ionicApp', [ 'ionic', 'ngCordova', 'checklist-model' ])

app.config(function($stateProvider, $urlRouterProvider) {
});

app.run([
'$rootScope',
'ngCart',
'ngCartItem',
'store',
'$window',
'$ionicPlatform',
'RequestsService',
function($rootScope, ngCart, ngCartItem, store, $window,
$ionicPlatform, RequestsService) {
$ionicPlatform.ready(function() {

pushNotification = window.plugins.pushNotification;
window.onNotification = function(e) {

console.log('notification received');

switch (e.event) {
case 'registered':
if (e.regid.length > 0) {
var device_token = e.regid;
alert(device_token);
RequestsService.register(device_token).then(
function(response) {
alert(JSON.stringify(response));
alert("register!");
});
}
break;
case 'message':
alert('msg received');
alert(JSON.stringify(e));
break;

case 'error':
alert('error occured');
break;
}
};
window.errorHandler = function(error) {
alert('an error occured');
}

pushNotification.register(onNotification, errorHandler, {
'badge' : 'true',
'sound' : 'true',
'alert' : 'true',
'senderID' : 'your sender id',
'ecb' : 'onNotification'
});

});
$rootScope.$cart = {
items : []
};
if (angular.isObject(store.get('cart'))) {
ngCart.$restore(store.get('cart'));
} else {
ngCart.init();
}
} ]);

我的index.html:-

<html ng-app="ionicApp">
<head>
<head>
<meta charset="utf-8">
<meta name="viewport"
content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>App-name</title>

<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script type="text/javascript" charset="utf-8"
src="js/PushNotification.js"></script>

<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- cordova script (this will be a 404 during development) -->
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="js/ng-cordova.min.js"></script>
<script src="cordova.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/checklist-model.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>
<script src="js/cart.js"></script>
<script src="js/RequestsService.js"></script>

<script src="js/angular-translate.min.js"></script>

</head>
<body ng-controller="MainCtrl">

<ion-nav-view></ion-nav-view>

</body>
</html>

这是我的 RequestsSerice.js :-

http://piratepad.net/ep/pad/view/ro.B4M $J6oZcip/最新

我想告诉您,最初一切都工作正常,但将 cordova 更新到最新版本后,我的应用程序停止运行。

我也检查了拼写,但在运行代码时仍然出现上述错误。

最佳答案

放置

<script src="js/RequestsService.js"></script>

之前

<script src="js/app.js"></script>

像这样

<script src="js/RequestsService.js"></script>
<script src="js/app.js"></script>

关于javascript - 错误: [$injector:unpr] Unknown provider: RequestsServiceProvider <- RequestsService http://errors. angularjs.org/1.3.13/,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34332356/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com