を使用して AJAX 呼び出しを実行しようとしていngResource
ます。以下のコードでは、「a」と「b」の両方が出力されますが、からの AJAX 呼び出しTable.import()
は行われません。AJAX 呼び出しを の外に移動すると、onFileRead
機能します。何が問題なのですか?
var TableImportController = ['$scope','Table', 'project', 'table',
function($scope, Table, project, table) {
$scope.table = table;
$scope.project = project;
$scope.onFileRead = function(file) {
console.log('a');
Table.import({ data : file.data}, function() {
}, function() {
});
console.log('b');
};
}];
テーブルはngResource
.factory('Table', function($resource) {
var Table = $resource('/api/tables/:id:listAction/:itemAction',
{
id: '@id',
listAction: '@listAction',
itemAction: '@itemAction'
},
{
update: { method: 'PUT' },
import : { method: 'POST', params: { listAction: 'import' }},
}
);
return Table;
});