<!DOCTYPE html>
<html ng-app="myModule">
<head>
<script data-require="angular.js@1.2.25" data-semver="1.2.25" src="https://code.angularjs.org/1.2.25/angular.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-controller="httpController">
<h1>Explaining Http Service using git api</h1>
<div>
{{error}}
</div>
<div>Name:{{details.name}}</div>
<div>Blog:{{details.blog}}</div>
<div>
<img ng-src="{{details.avatar_url}}" title={{details.name}}>
</div>
</body>
</html>
// Code goes here
//Explaining modules
(function(){
//Creates module
var app = angular.module("myModule",[])
var httpController = function($scope,$http){
var onFetchComplete = function(success){
//angular return data in data attribute
$scope.details = success.data;
};
var onError = function(error){
$scope.erros = "Unable to fetch the data";
};
$http.get("https://api.github.com/users/rahulsahay19").
then(onFetchComplete,onError);
};
//Wiring up controller with the module created
app.controller("httpController",httpController);
//Self Executing JS function
}());
/* Styles go here */