[英]Meanjs How to link one query to a different controller
我有一個名為article的crud-module和一個名為Devices的anther。 我想文章crud-module中的數據也可以在Device文章中找到。 有誰知道如何實現這個?
devicesApp.controller('DevicesController', ['$scope', '$stateParams', '$location', 'Authentication', 'Devices','$modal', '$log',
function($scope, $stateParams, $location, Authentication, Devices, $modal, $log) {
$scope.authentication = Authentication;
$scope.devices = Devices.query();
這是我的文章查詢
$scope.articles = Articles.query();
你不能(也不應該)與這樣的控制器進行通信。 為了使此代碼有效,文章和設備需要是工廠或服務。
devicesApp.factory('Articles', function(){
return {
query: function(){
return {/*Your data here*/};
};
};
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.