AngularJS Promise : $http GET CF
A simple example using $http.get() to discover its promises and theirs specific functions like success() or error()
by brandon_rmsy
HTML
<div ng-app>
<div ng-controller="PromiseCtrl">
<h2>$http.get()</h2>
<h3>Insights IDs</h3>
<p>{{ids}}</p>
<p ng-repeat="data">
<font ng-repeat="(key, value) in data">
{{key}} : {{value}}
</font>
</p>
</div>
</div>
JavaScript
function PromiseCtrl($scope, $http) {
$http.get('http://classifinity.com/api/insights/df?key=*&num=50').then(function(value) {
//$scope.example2 = value.data.response.docs;
var data = value.data.response.docs
for (var i = 0; i < data.length; i++) {
$scope.ids += "\n" + (data[i].id);
}
});
}