这是我对父表单的代码
<div ng-include="'app/modules/common/layout/create-rule-header-actions.tpl.html'"></div>
<div style="clear: both"></div>
<!-- Header Attributes Template-->
<div ng-include="'app/modules/common/layout/create-rule-header.tpl.html'"></div>
<div style="clear: both"></div>
<!-- First row start -->
<div class="row">
<!-- Left Side Block: Expression Builder for Primary attributes -->
<span class="col-sm-9 nopadding expression-block" ng-if="createCtrl.rfc.showTree && createCtrl.rfc.attributes.length > 0" ng-class="createCtrl.rfc.fullscreen?'fullscreen':''">
<div class="row rf-tree-box marginLeftRight10" ng-controller="PrimaryMappingController as mappingCtrl">
<div class="col-lg-12 rf-nodes-content" griffin-mapping-component-reorder mcr-toggle="mappingCtrl.rfc.showReorder">
<label class="width99">Expression Builder
<div class="sub-label ng-binding">Configure attributes for selected channel(s).</div>
</label>
<div ui-tree="mappingCtrl.rfc.treeOptions" id="tree2-root" data-max-depth="5" data-drag-delay="100" >
<ol ui-tree-nodes ng-model="createCtrl.currentRule.criteria" ng-init="mappingCtrl.currentAttributes(this)">
<li ng-repeat="node in createCtrl.currentRule.criteria track by node.id" ui-tree-node ng-include="'app/modules/common/layout/mapping/primary-node-tmpl.html'"></li>
</ol>
</div>
<label style="margin-top:80px;">Expression Viewer
<div class="sub-label ng-binding">Generated expression for configured attributes.</div></label>
<div ng-if="createCtrl.rfc.showTree " ng-controller="PrimaryMappingController as mappingCtrl">
<div class="rf-nodes-content">
<textarea id="expressionText" class="expressionText" placeholder="Dynamic expression" cols="30" rows="5" readonly ng-model="createCtrl.rfc.expression"></textarea>
</div>
</div>
</div>
</div>
</span>
这是我的儿童表格代码
<span ng-if="(node.type == 'L')" ng-include=" 'app/modules/common/widgets/mapping-tree/mapping-logical-node.html'"></span>
<span ng-if="(node.type == 'X')" ng-include="'app/modules/common/widgets/mapping-tree/mapping-expression-node.html'"></span>
</div>
{{$ root.loadMoreText}}
我想在子表单上为子表单中的所有更改设置一个观察程序,并在父表单上检测相同内容。我正在尝试从父表单设置子表单上的观察程序。
请帮忙
尼基尔
答案 0 :(得分:0)
你看看$ broacast,$ on和emit?
在您的案例中,它可能是更好的解决方案
https://docs.angularjs.org/api/ng/type/ $ rootScope.Scope
另一个解决方案是将范围值从父级映射到子级,或者重用来自子级的父级范围的setter