i am trying to make an agenda with contacts and i just started learning AngularJS. So far i did a php that generates me a JSON, load it on angular controller and than show it on html.
This is the angular code
var Agenda = angular.module('Agenda', []);
Agenda.controller('Contacts', function($scope, $http) {
$http.get('php/contacts.php').success(function(data) {
$scope.jsonContacts = data;
});
});
And this is the HTML
<section class="agenda" ng-app="Agenda">
<ul ng-controller="Contacts">
<li ng-repeat="contact in jsonContacts">
<div class="col1">{{contact.contact_id}}</div>
<div class="col2">{{contact.contact_firstname + ' ' + contact.contact_lastname}}</div>
<div class="col3">{{contact.contact_phone}}</div>
<div class="col4">{{contact.contact_email}}</div>
</li>
</ul>
<a>Refresh</a>
</section>
So far so good but now i am trying to refresh the content of the list when i press on the Refresh and i have no idea how to do that. If i also did something wrong in this code please let me know.
Thank you in advance, Daniel!