大街创建了一个应用程序在我的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>
你有一个理由使用的角度非常非常过时的版本? –
不,我只是试过应该仍然可以工作 –