Javascript 如何在angular.js中自动更新视图上的数据

Javascript 如何在angular.js中自动更新视图上的数据,javascript,angularjs,Javascript,Angularjs,我已在查看网站上显示手机数据: <table class="table table-stripes data-tables" ng-controller="GetData as mydata"> <tr> <th align="center"><div align="center">S.#</div></th> <th align=

我已在查看网站上显示手机数据:

<table class="table table-stripes data-tables" ng-controller="GetData as mydata">
            <tr>
                <th align="center"><div align="center">S.#</div></th>
                <th align="center"><div align="center">Name</div></th>
                <th align="center"><div align="center">Number</div></th>
                <th align="center"><div align="center">Edit</div></th>
                <th align="center"><div align="center">Delete</div></th>
            </tr>
            <tr ng-repeat="alldata in mydata.row | filter:search ">
                <td>{{alldata.id}}</td>
                <td>{{alldata.name}}</td>
                <td>{{alldata.numbers}}</td>
                <td><button class="btn btn-primary">Edit</button></td>
                <td><button class="btn btn-danger">Delete</button></td>
            </tr>
        </table>
我应该如何处理getdata controller 当用户添加新记录时,我应该怎么做
尝试在add number controller中刷新页面。那可能会有帮助

myApp.controller("addNumber",['$http','$log','transformRequestAsFormPost','$location','$route', function($http,$log,transformRequestAsFormPost,$location,$route){

    this.add = function(name,number){

    var mydata='name='+name+'&number'+number;
        $http({
            method: 'POST',
            url: 'process/addnumbers.php',
             data:{
                name: name,
                number: number
             }}).
  success(function(data, status, headers, config) {
    // this callback will be called asynchronously
    // when the response is available
    $log.log(data);
   if(data == 'true')
   {

        $route.reload();
        // get the current path
        $location.path();

        // change the path
        $location.path('/Dashboard');

   }
   else
   {

   }

  }).
  error(function(data, status, headers, config) {
    // called asynchronously if an error occurs
    // or server returns response with an error status.
  });
    }
}]);
在控制器中注入$route服务

myApp.controller("addNumber",['$http','$log','transformRequestAsFormPost','$location','$route', function($http,$log,transformRequestAsFormPost,$location,$route){

    this.add = function(name,number){

    var mydata='name='+name+'&number'+number;
        $http({
            method: 'POST',
            url: 'process/addnumbers.php',
             data:{
                name: name,
                number: number
             }}).
  success(function(data, status, headers, config) {
    // this callback will be called asynchronously
    // when the response is available
    $log.log(data);
   if(data == 'true')
   {

        $route.reload();
        // get the current path
        $location.path();

        // change the path
        $location.path('/Dashboard');

   }
   else
   {

   }

  }).
  error(function(data, status, headers, config) {
    // called asynchronously if an error occurs
    // or server returns response with an error status.
  });
    }
}]);