Can anyone help me figure out why my function is jumping after completing the request? It seems to be skipping over .then(function(result){ }
.
I suspect that the issue might be related to the <a>
element with an onclick
attribute containing an href
attribute.
Has anyone encountered this problem before?
var app = angular.module('devicesFromGroup', ['ngResource']);
var myInjector = angular.injector(["ng"]);
var $http = myInjector.get("$http");
function funcb($http){
console.log("OLIEIEIEIEI");
$http.get('http://localhost:8080/api/stuff/2')
.then(function(result) {
console.log("it's not printed");
});
}
function funcC(id){
myInjector.invoke(funcb);
return true;
};
In another section of my JavaScript:
var a = document.createElement("a");
a.setAttribute('href',"http://localhost:8080/DevicesFromGroup.html");
a.setAttribute('onclick',"funcC(id);");