I'm currently working on a project using angular-boilerplate and I am having trouble creating a new service and calling it inside controllers. I've defined the service in app/services/first.js as shown below:
define(function (require) {
require("services/_module");
var angular = require("angular");
angular.module("App.services").service("AppFirstService", function ($scope) {
return {
sayHello: function() {
return "Hello, World!"
}
};
});
});
I have added its requirement to the _package.js file as follows:
define(function (require) {
require("services/_module");
require("services/first");
});
and then injected it into the controller in app/controllers/first.js:
define(function (require) { require("controllers/_module"); require("services/first");
var angular = require("angular");
angular.module("App.controllers").controller("AppFirstCtrl", ['$scope', 'AppFirstService', function ($scope) {
}]);
});
However, I encountered the following error:
Error: [$injector:unpr] Unknown provider: $scopeProvider <- $scope <- AppFirstService
Can anyone help me troubleshoot this issue?