Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // html
- <button ng-click="hello">Click here</button>
- <div>
- <ng-repeat"name in users">
- {{name}}
- </div>
- //maincontroller.js
- app.controller('mainController',function($scope,$http) {
- $scope.users = {}
- $scope.hello = function() {
- $http.get('http://localhost:3000/api/users')
- .success(function(data) {
- $scope.users = data;
- }).catch(function(error) {
- console.error(error);
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement