アベニューで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>
あなたが角度の非常に非常に古いバージョンを使用する理由はありますか? –
いいえ、私はちょうどまだ動作するはずです。 –