notice required on search input we need to use ng-submit cause of that
form ng-submit="search(username)"
input type="search" required ng-model="username"
input type="submit"
h1 {{user.name}}
img ng-src="user.avatar_url"
==========
var onUserComplete = function (response) {
$scope.user = response.data;
}
var onError = function (reason) {
$scope.error = "Could not fetch the user";
}
$scope.search = (input) => {
$http.get("http://api.github.com/users/" + input)
.then(onUserComplete, onError);
};