php - Angularjs:Need help on two way binding(bipolar binding) -


when value change in back-end(in case mysql,patient details) other user(other console) ,i want update values on page @ same time(without refreshing page) .how possible. code given below.

myscript.js

var ajaxapp=angular.module('ajaxapp',[]); ajaxapp.controller('ajaxcontroller',function ajaxcontroller($scope,$http){ $http.get('core/getdata.php').success(function(data){     $scope.patient=data; }); }); 

my php page

<tr ng-animate="'animate'" ng-repeat="p in    patient|filter:pnametext|limitto:10">      <td><div class="btn btn-info">{{p.opno}}</div></td>                  <td><b><a href="getptdetails.php?pid={{p.pid}}">{{p.pname | uppercase}}</a></b></td>                  <td>                  <div ng-switch on="p.pcatid">                    <div ng-switch-when="1">                      1                    </div>                    <div ng-switch-when="2">                     2                    </div>                    <div ng-switch-when="3">                      3                    </div>                                 </div>                  </td>                  <td>{{p.page}}</td>                  <td>{{p.phusfather}}</td>                  <td>{{p.phnumber}}</td>                  <td><a href="patientq.php?pid={{p.pid}}"><button class="btn btn-danger">add queue</button></a></td>              </tr>        

suggest use socket.io(web socket) group people editing same content in same chanel, broadcast modification others, , notify other people , apply change. ajax not real time , costs more http://socket.io/

socket.connect(xx);  socket.on('change', function(data) {    alert('change happen!');    $scope.data = data;    $scope.$apply();  })  $scope.$watch('data', function() {    if (change) {      socket.emit('change', $scope.data);    }  })


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -