Advertisement
Guest User

Untitled

a guest
Sep 17th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. [
  2. {id:1, content:"Hello World!"},
  3. {id:2, content:"Testing 1, 2, 3..."},
  4. {id:3, content:"I am from the database"}
  5. ]
  6.  
  7. <div ng-controller="MessageController">
  8. <ul>
  9. <li ng-repeat="m in messages">{{m.content}}</li>
  10. </ul>
  11. </div>
  12.  
  13. function MessageController($scope, $http) {
  14. $scope.getAll = function(callback) {
  15. $http.get('/messages').success(function(response) { callback(response); });
  16. }
  17.  
  18. $scope.messages = $scope.getAll(function(data) { return JSON.stringify(data); });
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement