1
リソースファクトリからデータを受信していますが、出力しようとすると要素がレンダリングされますが空のままです。私はそれがコンソールログで解決されているのが分かるので奇妙です。アングルでは要素が表示されますが、データは表示されません
コントローラ
dichotomy.controller('WorkplaceOverview', ['$scope', 'WorkPlace', function ($scope, WorkPlace) {
$scope.workplaces = WorkPlace.all({get_all:1}).$promise.then(function (response) {
$scope.workplaces = response;
console.log($scope.workplaces);
});
}]);
工場
dichotomy.factory('WorkPlace', function ($resource) {
return $resource('api/create_workplace/:id/:get_all/', {}, {
all: {method: "GET", isArray: true, params: {get_all: '@get_all'}},
get: {method: "GET", isArray: false, params: {id: '@id'}},
update: {method: 'PUT', params: {id: '@id'}}
});
});
同じ結果をお試しください。それは何も解決しませんでした – qr11
'console.log'が正しい情報を出力するなら、あなたはどこか他の値を設定しています。 – Wainage
あなたのHTML(コントローラ内)に '{{workplaces}}タグを挿入し、何かをレンダリングするかどうかを確認してください。 – Wainage