I am trying to solve a problem.
I have a table with four field.
here you go for my controller:
app.controller('crudCtrl', function($scope, $http) {
getAllContact = function() {
var data = $http.get("http://127.0.0.1:8000/api/v1/contact/")
.then(function(response) {
$scope.contacts = response.data;
}, function(response) {
$scope.connectionError = "Opps ! Having Trouble in loading this page ! \n It's Connection Error !!!";
});
};
getAllContact();
Above snippet is working fine but i want something different like.
When in backend/database/server happen any change like update/create/delete, so that the change automatically reflected in client side without refreshing or reloading page.
Currently my code working fine if i reload the page i see the change but i dont want it with reloading. i want it instantly whenever a change occurs in backend, so that i can see the change in client side without any page refreshing or reloading.
How can i achieve this?
If you want see my client, here you go for client side snippet:
<table class="table table-striped table-light">
<tbody>
<tr ng-repeat="contact in contacts | filterByName track by $index ">
<td>{{ contact.id }}</td>
<td>{{ contact.userid }}</td>
<td>{{ contact.name }}</td>
<td>{{ contact.email }}</td>
<td>{{ contact.phone }}</td>
<td>
</tr>
</tbody>
</table>