[英]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.