I am working on creating a web page that displays data in the table. The data in the table should change when a button is clicked. (Data from different URL should be populated to the table.
I can successfully populate and show the default data. I used onclick fucntion where I have called new URL data, but it is not working
//Storing results in empData
app=angular.module('app',[]);
app.controller('MyCtrl',function($scope,$http){
$http.get("url")
.success(function(response){
$scope.empData=response;
})
.error(function(){
});
});
//this function is called on clicking the button to update the data.
function myFunction()
{
app=angular.module('app',[]);
app.controller('MyCtrll',function($scope,$http){
$http.get("newurl")
.success(function(response){
$scope.empData=response;
$scope.reverse=true;
})
.error(function(){
});
});
Please provide me the solution to change the values of empData when the butoon is clicked