Created
May 29, 2014 15:50
-
-
Save troyswanson/d5afb10baf91553c0674 to your computer and use it in GitHub Desktop.
Property or $scope?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global angular*/ | |
var app = angular.module('app', []); | |
app.controller('UsersCtrl', function ($http) { | |
var that = this; | |
$http.get('https://api.github.com/users/troyswanson/repos') | |
.success(function (data) { | |
that.repos = data; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<div ng-controller="UsersCtrl as user" class="container"> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>Full Name</th> | |
<th>Stars</th> | |
<th>Watchers</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr ng-repeat="repo in user.repos"> | |
<td ng-bind="repo.full_name"></td> | |
<td ng-bind="repo.stargazers_count"></td> | |
<td ng-bind="repo.watchers_count"></td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script> | |
<script src="/js/property.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global angular*/ | |
var app = angular.module('app', []); | |
app.controller('UsersCtrl', function ($scope, $http) { | |
$http.get('https://api.github.com/users/troyswanson/repos') | |
.success(function (data) { | |
$scope.repos = data; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<div ng-controller="UsersCtrl" class="container"> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th>Full Name</th> | |
<th>Stars</th> | |
<th>Watchers</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr ng-repeat="repo in repos"> | |
<td ng-bind="repo.full_name"></td> | |
<td ng-bind="repo.stargazers_count"></td> | |
<td ng-bind="repo.watchers_count"></td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script> | |
<script src="/js/scope.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment