大街創建了一個應用程序在我的MySQL數據庫,以顯示所有用戶更新,一切工作正常,但是當我的PHP代碼返回包含數據的JSON範圍更新,但我沒有得到任何展示我AngularJS範圍並不在模型
<!Doctype html>
<html>
<head>
\t <title>Simple Dynamic Score Board | By Kascique Lowmans</title>
\t \t <meta charset="utf-8"/>
<link rel="stylesheet" href="style.css"/>
\t <script src="http://code.angularjs.org/1.2.13/angular.js"></script>
\t \t <meta name="viewport" content="width=device-width, initial-scale=1.0">
\t </head>
\t <script>
\t var webapp = angular.module('myapp', []);
\t \t \t webapp.controller('myusers', function($scope, $http){
\t \t \t $scope.users = [];
\t \t \t \t $http.get("selectdata.php").then(function(response){
\t \t \t \t $scope.users = response.data;
$scope.$apply();
alert($scope.users);
\t \t \t \t });
// $scope.$watch("users", function(){ alert('users scope changed');});
\t \t \t \t
\t \t \t });
\t \t \t
\t \t \t
\t \t \t
\t </script>
\t <body data-ng-app="myapp" >
\t <div class="control-group">
\t \t \t <h1>Select a user</h1>
\t \t \t <div data-ng-controller="myusers" >
\t \t \t \t <label class="control control--radio" data-ng-repeat="x in users"><span>{{$index + 1}}</span> {{ x.firstname +' '+x.lastname }} <b>{{ x.score}}</b>
\t \t \t \t \t <input type="radio" name="radio"/>
\t \t \t \t \t <div class="control__indicator"></div>
\t \t \t \t </label><br/>
<h1 id="trail"></h1>
\t \t \t \t <button ng-click="click()">+ Add score</button>
\t \t \t </div>
\t \t \t <footer>
© copyright <a href="http://www.kasciquelowmans.ml/">Kascique Lowmans</a>
</footer>
\t </div>
\t </body>
</html>
你有一個理由使用的角度非常非常過時的版本? –
不,我只是試過應該仍然可以工作 –