1
は、ここでは、コードです:角度スクリプトが実行されますページのロード後(解雇)
<html>
<head>
<script type='text/javascript'>
var myAppModule = angular.module('myApp', []);
myAppModule.factory('studentFactory', function(){
// The whole factory goes here.
});
myAppModule.controller('studentsController', ['$scope', 'studentFactory', function ($scope, studentFactory){
$scope.students = [];
studentFactory.getStudents(function (data){
$scope.students = data;
});
studentFactory.removeStudent(function (data){
alert('test');
$scope.students = data;
});
}])
</script>
</head>
<body ng-app='myApp'>
...
</body>
</html>
alert('test')
は、ページのロード時に解雇されます。どうすれば修正できますか?コード内の問題を気にしないでください、私はちょうどそれに取り組んでいます。ここで
はPlunkerのコードです:https://plnkr.co/edit/u7c13AIdKPjmdkzRUPXd?p=preview
.removeStudentsの実装を確認できますか?そして.getStudents?おそらく彼らは非同期ではないでしょう。 – Brant
もちろん、私は後で編集で提供したPlunkerのリンクに行くことをお勧めします。 –
また、まだ実装されていません。 –