2016-05-15 12 views
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'}} 
    }); 
}); 

答えて

3

あなたは二回(約束に二回目の)値を代入しています。

dichotomy.controller('WorkplaceOverview', ['$scope', 'WorkPlace', function ($scope, WorkPlace) { 
    WorkPlace.all({get_all:1}).$promise.then(function (response) { 
     $scope.workplaces = response; 
     console.log($scope.workplaces); 
    }); 
}]); 
+0

同じ結果をお試しください。それは何も解決しませんでした – qr11

+0

'console.log'が正しい情報を出力するなら、あなたはどこか他の値を設定しています。 – Wainage

+0

あなたのHTML(コントローラ内)に '{{workplaces}}タグを挿入し、何かをレンダリングするかどうかを確認してください。 – Wainage

関連する問題