I've got some app in AngularJs, and I've encountered a problem. I need to call a function from service in controller.
my service:
var DataService = ['$http', '$q', '$window', 'alert', function ($http, $q, $window, alert) {
function print () {
console.log('smth');
}
}
my controller:
var Controller = function ($scope, $state, OffersService, commonFunction, dataService, alert, blockUI) {
function printSmth () {
dataService.print();
}
}
function printSmth is called from ng-init in html, and I get exception saying that dataService.print is not a function.
Does anybody know the proper way to do it? I can't change it to .service it must be done this way.