私はmysqlデータベースの情報をhttp.get(url)で呼び出しています。最後に、その情報を持つテーブルを作成します。mysqlから自動的にリロードテーブル
これは動作していますが、手動でページを更新せずにデータベースに自動的に変更があった場合、コントローラがhttp.get(url)を呼び出すようにしたいと思います。
コメントまたはヒントがよく受けられます:D (私は角があります)。
これは私の現在のコードです:
data.js
angular.module('demo', [])
.controller('Hello', function($scope, $http, $timeout) {
$scope.loadData = function(){
$http.get('http://localhost:8888/nuevo/respuesta.php').
then(function(response) {
$scope.greeting = response.data;
//console.log($scope.greeting);
//console.log("hola");
});
};//se cierra la funcion
$scope.loadData();
});
index.htmlを
<div ng-controller="Hello">
<table>
<tr>
<th>ID</th>
<th>Banda</th>
<th>Cancion</th>
</tr>
<tr ng-repeat="x in greeting">
<td>{{x.`enter code here`IdCancion}}</td>
<td>{{x.Bandas_Musicales}}</td>
<td>{{x.Canciones}}</td>
</tr>
</table>
<button ng-click="loadData()">reload</button>
</div>
いくつかのコードを表示してください。ヘルプを受ける機会が増えます。 –
ああ、申し訳ありません、ここに行きます。 –