JSFiddle - React, Tailwind, and code Playground
HTML
<div ng-app='myApp' ng-controller='ProfileListCtrl'>
<h1>Data received</h1>
{{data}}
</div>
JavaScript
angular.module("myApp",[]);
angular.module("myApp").factory('ProfileData',['$http', function($http){
return function(myUrl) {
return $http.get(myUrl);
};
}]);
angular.module("myApp").controller('ProfileListCtrl',['$scope', 'ProfileData', function($scope,ProfileData) {
var myUrl="http://www.w3schools.com/website/customers_mysql.php";
//var myUrl= "http://httpbin.org/get?a=6&b=8";
var httpPromise = ProfileData(myUrl);
httpPromise.then(function onFulfilled(response) {
console.log("OK");
$scope.data = response.data;
}).catch(function onRejected(response) {
console.log("ERROR ", response.status);
});
}]);