I am currently in the process of calling a web service to retrieve data and display it in a list using directives.
- Upon loading my fiddle, I successfully load data from a
JSON
file. The data is displayed correctly in the list. - If I click the delete button, all items are removed from the list, which works as expected.
- However, when I click the refresh button, I want to call the service again to fetch fresh data but it does not show up in the list. Why?
Here is my code snippet: https://jsfiddle.net/8fjhLqnw/10/
.controller('he', function($http, $scope, sharedData) {
var h = this;
h.referesh=function(){
sharedData.get();
}
h.delete = function() {
sharedData.delete()
}
});
Please check out the updated version on Plunker:
http://plnkr.co/edit/iMpStNneDmIsabTnFqpP?p=preview
In simple terms, clicking the refresh button should load data from data.json and display it in list form.