<!DOCTYPE html>
<html>
<script src="http://www.sargonco.com/Uploads/Public/article/webdistut/javascript/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<h1>{{content}}</h1>
</div>
<p>The $http service executes different functions on success and failure.</p>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("wrongfilename.htm")
.then(function(response) {
$scope.content = response.data;
}, function(response) {
$scope.content = "Something went wrong";
});
});
</script>
</body>
</html>
|
{{content}}
The $http service executes different functions on success and failure.
|