I am struggling to get angular.resource.js to work with angular.js. It seems like Angular is loaded but angular.resource is not being recognized.
index.html
<!doctype html>
<html>
<head>
<script>
var require = {
shim: {
angular: {
exports: "angular"
},
"angular.resource": {
deps: [ "angular" ]
}
}
};
</script>
<script src="require.js"></script>
</head>
<body>
<div ng-controller="TagsController">
Example
</div>
<script>
require( ["TagsInit"] );
</script>
</body>
</html>
TagsInit.js
define([
"angular",
"angular.resource",
], function( angular ) {
var module = angular.module( "app.customer", [] );
module.controller( "TagsController", function( $scope, tagsService ) {
console.log( "TagsController executed" );
});
module.service( "tagsService", function( $resource ) {
console.log( "TagsService executed" );
});
angular.bootstrap( document.body, [ "app.customer" ] );
});
I suspect there may be an issue with the shim config that I'm overlooking:
shim: {
angular: {
exports: "angular"
},
"angular.resource": {
deps: [ "angular" ]
}
}
Currently using AngularJS v1.3.0-beta.2 along with angular.resource (same version).
The error message I'm receiving is:
Error: [$injector:unpr] Unknown provider: $resourceProvider <- $resource <- tagsService
http://errors.angularjs.org/1.3.0-beta.2/$injector/unpr?p0=%24resourceProvider%20%3C-%20%24resource%20%3C-%20tagsService