I am trying to access the $http service in AngularJS and execute the get function within my custom asyncAction function call without involving any HTML or Bootstrap. Can anyone help figure out a way to achieve this without manually inserting markup or triggering the AttendeeProxyController?
Here is my jsfiddle: http://jsfiddle.net/smartdev101/bdmkvr6g/
asyncAction: function(resultFunction, faultFunction) {
$http.get("https://api.github.com/users/angular")
.success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
console.log(data);
})
.error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
},
I have made some progress by updating the fiddle and adding some dummy HTML tags, but I am looking for a solution that does not require markup insertion or direct triggering of the controller. Is there a way to access $http purely through JavaScript without relying on the controller?
<span id="attendeeProxyController" ng-controller="AttndeeProxyController"></span>