Meanjs 如何 link 一个查询到不同的控制器

Meanjs How to link one query to a different controller

我有一个名为 article 的 crud 模块和另一个名为 Devices 的模块。我希望文章 crud-module 中的数据也出现在设备文章中。有人知道如何实现吗?

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*/};
    };
  };
});