Last active
August 29, 2015 14:21
-
-
Save johnlindquist/d9136a2ff5c95c3a339e to your computer and use it in GitHub Desktop.
This file contains hidden or 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="workshop"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>AngularJS Jumpstart</title> | |
<link rel="stylesheet" href="bootstrap.min.css"/> | |
<script src="angular.js"></script> | |
<script src="workshop.js"></script> | |
<script src="people.js"></script> | |
</head> | |
<body ng-controller="BodyController as body"> | |
<ul> | |
<li ng-repeat="person in body.people">{{person.name}}</li> | |
</ul> | |
</body> | |
</html> |
This file contains hidden or 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
angular.module("people", []) | |
.service("peopleService", function PeopleService($http){ | |
var peopleService = this; | |
peopleService.getPeople = function(){ | |
return $http.get("people.json").then(function(result){ | |
return result.data.results; | |
}) | |
}; | |
}); |
This file contains hidden or 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
angular.module("workshop", ["people"]) | |
.controller("BodyController", function(peopleService){ | |
var body = this; | |
peopleService.getPeople().then(function(people){ | |
body.people = people; | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment