简体   繁体   English

需要帮助传递值“ AngularJS”

[英]Need help passing values “AngularJS”

i need some help trying to pass: 我需要一些帮助来通过:

(Page 1 -> Module 1 -> Controller 1) to (Page 2 -> Module 2 -> Controller 2) (页面1->模块1->控制器1)到(页面2->模块2->控制器2)

like that: 像那样:

Module informes - Controller InformesCtrl 模块通知-控制器通知Ctrl

//Page 1
<html lang="en" class="no-js"  ng-app="informes">
<a ng-href="../node-informes/node-informes.html">
    <p class="text-center text-truncate">
        <small ng-click="nodeID(item.nid)">{{item.title}}</small>
    </p>
</a>

Module node-informes - Controller NodeInformesCtrl 模块节点信息-控制器NodeInformesCtrl

//Page 2
<html lang="en" class="no-js"  ng-app="node-informes">
<div ng-controller="NodeInformesCtrl" ng-value=""></div>  

I tried with $rootScope, creating service, $broadcast, $on, and a lot of other things. 我尝试使用$ rootScope来创建服务,$ broadcast,$ on以及其他很多东西。 I really need your help because i don't know how to solve that. 我真的需要您的帮助,因为我不知道该如何解决。 If you can give me some tips. 如果可以给我一些提示。

What I really need is to store the "selected value" of a list and print in a different page. 我真正需要的是存储列表的“选定值”并在其他页面中打印。

How would you solve that??? 您将如何解决??? Thanks in advance. 提前致谢。

There should be a parent module in which you are injecting the child modules. 应该有一个要在其中注入子模块的父模块。 Create a service in the parent module with getters and setters. 在带有getter和setter的父模块中创建服务。 you can inject this service to both the controllers in child modules. 您可以将此服务注入子模块中的两个控制器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM