JSFiddle - React, Tailwind, and code Playground
JavaScript
$scope.$on('user', function onUserData (e, data) {
$scope.user = data.user;
$scope._userEditor = false;
if (data.user && data.user.company_id >= 0) {
console.log('running .get');
CompanySvc.get(data.user.company_id)
.then(function (data) {
console.log('call to .get returned');
return $rootScope.$broadcast('company', data);
});
console.log('leaving the IF block');
} else {
return $rootScope.$broadcast('newCompany');
}
_.forEach($scope.maillists, function (m) {
m.enabled = !!_.find(data.user.maillist, { maillist_id: m.maillist_id });
});
return;
});
/* this is a cut out of the above to focus on what I'm talking about from line 10. */
} else {
return $rootScope....
/* ^== My feeling is that when this runs it will end the whole function that started from $scope.on at the top. */
}
_.forEach($scope.maillists.... <== and will block this code from running