Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 从父窗体设置子窗体的监视程序_Angularjs_Watch - Fatal编程技术网

Angularjs 从父窗体设置子窗体的监视程序

Angularjs 从父窗体设置子窗体的监视程序,angularjs,watch,Angularjs,Watch,这是我对父窗体的代码 表达式生成器 为所选频道配置属性。 表达式查看器 为配置的属性生成表达式。 这是我的孩子表单的代码 {{$root.loadMoreText} 我想在子窗体上为子窗体中的所有更改设置一个监视程序,并在父窗体上检测相同的更改。我正在尝试从父窗体将监视程序设置为子窗体 请帮忙 Nikhil你看过$broacast、$on和emit吗 对你来说,这可能是一个更好的解决方案 $rootScope.Scope 另一种解决方案是将作用域值从父级映射到子

这是我对父窗体的代码


表达式生成器
为所选频道配置属性。
  • 表达式查看器 为配置的属性生成表达式。

    这是我的孩子表单的代码

    
    

    {{$root.loadMoreText}

    我想在子窗体上为子窗体中的所有更改设置一个监视程序,并在父窗体上检测相同的更改。我正在尝试从父窗体将监视程序设置为子窗体

    请帮忙


    Nikhil

    你看过$broacast、$on和emit吗

    对你来说,这可能是一个更好的解决方案

    $rootScope.Scope


    另一种解决方案是将作用域值从父级映射到子级,或者从子级重用父级作用域中的setter

    请给出一个小代码片段好吗?刚开始使用此功能的用户为此尝试了$emit。获取$scope.on不是有效的函数。人们在谷歌上搜索它,说这是因为emit在指令初始化之前就被触发了。但是这个发射作为观察者的一部分被解雇了。我该怎么解决呢?如果你看一下文档,它是“$on”而不是“on”
      <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>