Just starting out with AngularJS and I have a question. Can I use a factory code (logger) inside a private function like the example below? I'm still working on understanding angular concepts. Thanks for your help:
(function () {
'use strict';
angular
.module('app.admin')
.controller('UploadController', UploadController);
UploadController.$inject = ['$scope', 'FileUploader', 'dataservice', 'logger', 'config'];
function UploadController($scope, FileUploader, dataservice, logger, config)
{
...
logger.info('blah blah blah', 'Error!');
...
SomeFunction();
...
}
//private function
function SomeFunction()
{
//... code hidden for brevity
$.ajax({
type: "POST",
url: url,
async: true,
cache: false,
data: dataString,
success: function(results)
{
//need to use the 'logger' factory here
//logger.info('blah blah blah', 'Error!'); <= this wont work
}
});
}
})();
Thank you