This is the HTML and JavaScript code I have written.
<!DOCTYPE html>
<html ng-app>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="js/angular.js"></script>
<script src="js/app.js"></script>
</head>
<body ng-controller="MainController">
Name: {{user.login}}
</body>
</html>
Here is my JavaScript function for MainController.
var MainController = function($scope, $http) {
var onUserComplete = function(response) {
$scope.user = response.data;
};
$http.get("https://api.github.com/users/sfshameem5")
.then(onUserComplete);
$scope.message = "Hello, Angular!";
}
I am hoping to display the user's login name with {{user.login}}
, but it's not showing up as expected.