JSFiddle - React, Tailwind, and code Playground
by Daniel Lamb
HTML
<div ng-app="myApp">
<div ng-controller="Example">
<button ng-click="fetch()">Get</button>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('Example', ['$http', '$scope', function ($http, $scope) {
$scope.fetch = function(e) {
$http.get('/echo/json/', {
// data to send on the query string
params: { foo: 'bar' }
})
.success(function(data, status, headers, config) {
console.log('success', data);
})
.error(function(data, status, headers, config) {
console.log('error');
})
.finally(function(data, status, headers, config) {
console.log('finally');
});
};
}]);