JSFiddle - React, Tailwind, and code Playground

by shushanth pallegar

HTML

<body ng-app="App">
    


<div ng-controller="mainCtrl as main">
    
    <button ng-click="main.getDetails()">get !</button>    
    
    <div>
        
        <p ng-repeat = "item in main.items track by $index">
            First Name : {{item.fname}}
            Last Name : {{item.lname}}
            
        </p>
    </div>
  
    
    
</div>
    
    </body>

JavaScript

var app = angular.module('App',[]);

app.controller('mainCtrl',mainCtrl);

mainCtrl.$inject = ['$scope','$http'];

function mainCtrl($scope,$http) {
    
    var self = this,
        scope = $scope,
        http = $http
    
    self.items = [];
    
    self.getDetails=function() {
       
        http.jsonp("http://www.filltext.com/?callback=JSON_CALLBACK&rows=5&fname={firstName}&lname={lastName}").
        success(function(data){
        
            self.items = data;

            console.log(self.items);
        }).
        error(function(error){
        console.log(error)
        
        })
        
    }
    
    

}