In my application, a user clicks a button which triggers runsOnClick
. In runsOnClick
, I try to use a promise to call someFunc
(this happens as expected) and once someFunc
has finished running, I'm expecting this code (the then
part of the promise) inside runsOnClick
to run but it never does
then(function() {
console.log("in runsOnClick");//this never runs, why?
});
How do I structure a promise so that all the code in runsOnClick
runs?
$scope.someFunc = function(){
console.log("in someFunc");
$http.get('http://localhost:8090/endpoint').success(function(data){
console.log(data, "this logs");
});
},
$scope.runsOnClick = function(){
$scope.someFunc().then(function() {
console.log("in runsOnClick");//this never runs, why?
});
},