未知提供者:$routeProvider <- $resource
Unknown provider: $resouceProvider <- $resouce
我找了一会儿,没能查到问题所在
我收到此错误:
Unknown provider: $resouceProvider <- $resouce <- apartmentsFactory
我正在按以下顺序加载脚本:
<script src="../node_modules/angular/angular.min.js"></script>
<script src="../node_modules/angular-base64-upload/dist/angular-base64-upload.min.js"></script>
<script src="../node_modules/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="../node_modules/angular-resource/angular-resource.min.js"></script>
<script src="../node_modules/ng-dialog/js/ngDialog.min.js"></script>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="scripts/script.js"></script>
<script src="scripts/app.js"></script>
<script src="scripts/controllers.js"></script>
<script src="scripts/services.js"></script>
app.js依赖关系如下:
angular.module('rieltorApplication', ['naif.base64', 'ui.router', 'ngResource', 'ngDialog'])
services.js
angular.module('rieltorApplication')
.constant("baseURL", "http://localhost:3000/")
.factory('apartmentsFactory', ['$resouce', 'baseURL', function($resource, baseURL){
return $resource(baseURL + "apartments/:id", null, {
'update': {
method: 'PUT'
}
});
}])
controllers.js
angular.module('rieltorApplication')
.controller('apartmentsController', ['$scope','ngDialog', 'apartmentsFactory', function($scope, ngDialog, apartmentsFactory){
//code for the filters button
$scope.navopen= false;
$scope.navtracker = function () {
if($scope.navopen === false)
$scope.navopen = true;
else
$scope.navopen = false;
}
//gets app apartments in the data base and sets the view depending on responce
$scope.showMenu = false;
apartmentsFactory.query(
function (response) {
$scope.apartments = response;
$scope.showMenu = true;
},
function (response) {
$scope.message = "Error: " + response.status + " " + response.statusText;
});
}])
像这样尝试,在尝试之前还要清除缓存
angular.module('rieltorApplication')
.constant("baseURL", "http://localhost:3000/")
.factory('apartmentsFactory', ['$resource', 'baseURL', function($resource, baseURL){
return $resource(baseURL + "apartments/:id", null, {
'update': {
method: 'PUT'
}
});
}])
我找了一会儿,没能查到问题所在
我收到此错误:
Unknown provider: $resouceProvider <- $resouce <- apartmentsFactory
我正在按以下顺序加载脚本:
<script src="../node_modules/angular/angular.min.js"></script>
<script src="../node_modules/angular-base64-upload/dist/angular-base64-upload.min.js"></script>
<script src="../node_modules/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="../node_modules/angular-resource/angular-resource.min.js"></script>
<script src="../node_modules/ng-dialog/js/ngDialog.min.js"></script>
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="scripts/script.js"></script>
<script src="scripts/app.js"></script>
<script src="scripts/controllers.js"></script>
<script src="scripts/services.js"></script>
app.js依赖关系如下:
angular.module('rieltorApplication', ['naif.base64', 'ui.router', 'ngResource', 'ngDialog'])
services.js
angular.module('rieltorApplication')
.constant("baseURL", "http://localhost:3000/")
.factory('apartmentsFactory', ['$resouce', 'baseURL', function($resource, baseURL){
return $resource(baseURL + "apartments/:id", null, {
'update': {
method: 'PUT'
}
});
}])
controllers.js
angular.module('rieltorApplication')
.controller('apartmentsController', ['$scope','ngDialog', 'apartmentsFactory', function($scope, ngDialog, apartmentsFactory){
//code for the filters button
$scope.navopen= false;
$scope.navtracker = function () {
if($scope.navopen === false)
$scope.navopen = true;
else
$scope.navopen = false;
}
//gets app apartments in the data base and sets the view depending on responce
$scope.showMenu = false;
apartmentsFactory.query(
function (response) {
$scope.apartments = response;
$scope.showMenu = true;
},
function (response) {
$scope.message = "Error: " + response.status + " " + response.statusText;
});
}])
像这样尝试,在尝试之前还要清除缓存
angular.module('rieltorApplication')
.constant("baseURL", "http://localhost:3000/")
.factory('apartmentsFactory', ['$resource', 'baseURL', function($resource, baseURL){
return $resource(baseURL + "apartments/:id", null, {
'update': {
method: 'PUT'
}
});
}])