I have the following angular service.
angular.module('myApp')
.service('StatusService', function StatusService() {
var statusService= {
show: 'off',
on: function() {
this.show = 'on';
},
off: function() {
this.show = 'off';
}
};
return statusService;
});
Which is injected into a controller, and its on function is invoked, like this:
angular.module('myApp')
.controller('aController', function (StatusService) {
StatusService.on();
})
But I get the following error.
TypeError: Object #<Object> has no method 'on'