Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [
- {id:1, content:"Hello World!"},
- {id:2, content:"Testing 1, 2, 3..."},
- {id:3, content:"I am from the database"}
- ]
- <div ng-controller="MessageController">
- <ul>
- <li ng-repeat="m in messages">{{m.content}}</li>
- </ul>
- </div>
- function MessageController($scope, $http) {
- $scope.getAll = function(callback) {
- $http.get('/messages').success(function(response) { callback(response); });
- }
- $scope.messages = $scope.getAll(function(data) { return JSON.stringify(data); });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement