我搜索时我的表没有更新

时间:2019-04-23 09:26:08

标签: javascript html angularjs

我的问题是:我有一个表,在我获取数据库元素时始终会刷新(),这意味着如果我按GET按钮,则表会更新ok,但是如果我搜索该表不会更新,并且看起来为空

   <table class="table table-dark">
        <thead>
            <tr>
                <th>Country</th>
                <th>Year</th>
                <th>Film</th>
                <th>Distributor</th>
                <th>Money</th>
                <th>Rank</th>
                <th>Spectator</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="taking in takingstats">
                <td>{{ taking.country }}</td>
                <td>{{ taking.year }}</td>
                <td>{{ taking.film }}</td>
                <td>{{ taking.distributor }}</td>
                <td>{{ taking.money }}</td>
                <td>{{ taking.rank }}</td>
                <td>{{ taking.spectator }}</td>
                <td>
                    <button  class="btn btn-danger" ng- 
    click=deleteFilm(taking.film)>Borrar</button>
                </td>
            </tr>
            <tr>
                <td>
                    <input class="form-control" value="new country" ng- 
    model="newTaking.country"/>
                </td>
                 <td>
                    <input class="form-control" value="new year" ng- 
    model="newTaking.year"/>
                </td>
                <td>
                    <input class="form-control" value="new film" ng- 
    model="newTaking.film"/>
                </td>
                <td>
                    <input class="form-control" value="new distributor" 
     ng-model="newTaking.distributor"/>
                </td>
                <td>
                    <input class="form-control" value="new money" ng- 
     model="newTaking.money"/>
                </td>
                <td>
                    <input class="form-control" value="new rank" ng- 
     model="newTaking.rank"/>
                </td>
                <td>
                    <input class="form-control" value="new spectator" ng- 
     model="newTaking.spectator"/>
                </td>
                <td>
                     <button class="btn btn-primary" ng- 
     click="addData()">Añadir</button>
                </td>
            </tr>

        </tbody>
    </table>
    </div>
    <div>
    <label>URL:<input value="borrar" class="form-control text-center" ng- 
    model="url"/></label>
    <button class="btn btn-primary" ng-click="send()">Get</button>
    <button class="btn btn-primary" ng-click="putdataform(country, year, 
    film, distributor, money, rank, spectator)">Put</button>
    <button class="btn btn-danger" ng-click="deletedata(country, year, 
     film, distributor, money, rank, spectator)">Borrar todo</button>
     <button class="btn btn-primary" ng- 
     click="loadData()">LoadInitial</button>


     </div>

     <input class ="form-control" value="" ng-model="ranking"/>
        </td>
        <td>
        <buttom class="btn btn-primary" ng- 
      click="search()">Buscar</buttom>
        </td>
     </body>

JS:

    $scope.search = function (){
                   $http.get(API+"?rank="+$scope.ranking+"").then(function 
    (response){

                    $scope.takingstats = response.data;
                    console.log("Data received: "+ 
     JSON.stringify(response.data, null, 2));

                });
                };

不知道为什么即时搜索时不再起作用。我可以删除,完美张贴,但我无法正确搜索。 在Google控制台中,我收到了ok的数据,但没有更新表

Here is the problem ,table doesnt update

enter image description here

0 个答案:

没有答案