So back to where I should be. I used $http which is a service in AngularJS for reading from remote servers. It makes a request to the server and returns a response.
First I created a controller named 'contentController' within the angular module I used to define my angular application. The simply called the get method from the $http service to send my request to https://api.github.com/users. 'then' denotes the callback function upon a successful request. There I stored the received array of elements from the JSON string (response.data) into an attribute within $scope.
Then I used this controller in a div and used ngRepeat directive upon another div to repeat the required elements from the array to get the desired output.
Output
<<Nandun Bandara>>

No comments:
Post a Comment