After spending hours trying to figure it out, I have a question.
The issue here is that the data is being received faster than my services can load.
gen-service
function genEmpId() {
settingsService.getSettings().then(function (data) {
var comId = data.data[0].companyId;
console.log(comId);
var test = comId + ' - ';
return test;
});}
controller
function genId() {
var data = genService.genEmpId();
console.log(data); // The data is retrieved too quickly; how can I implement a callback?
}
When my controller loads, it calls the service but I'm getting an undefined return value.