未知的角度观察者

时间:2017-09-11 15:04:41

标签: angularjs angularjs-scope

我是刚进入AngularJS的Salesforce开发人员。 我的问题是关于这段代码:Unknown watcher
我使用一个很棒的片段来查找所选DOM元素的上下文中的观察者:
(我不得不删除此链接,因为我无法发布超过2个链接)
如果您在控制台中看到突出显示的' tr' ,则它有3个关联的观察者,但' tr' 只有一个单个与之关联的Angular表达式 - > showTheRow(),而所有其他表达式都使用' ::'进行单向绑定。运营商。为什么会这样?我错过了什么吗?

以下是代码段:

<tr ng-repeat="acc in ::setting_Records.dataWrapperMap['Dealer'] track by acc.account.Id" ng-show="showTheRow(acc.account)" class="dealerRow">
    <td class="filterable-cell">{{::acc.account.Name}} - {{::acc.account.Location__c}} - {{::acc.account.Unit_Name__c}}</td>
    <td class="filterable-cell" ng-class="::acc.pastCompVisits.indexOf('0') == 0 ? 'redClass' : 'greenClass' ">{{::acc.pastCompVisits}}</td>
    <td ng-repeat="set in ::acc.dayMon track by set.customerID+set.dayNumber" ng-class="::set.typeCol" class="filterable-cell">
        <div class="multipleEvents" ng-if="::(set.eventList.length > 1)">
            <apex:image value="{!URLFOR($Resource.MultiUser_Icon)}" styleClass="multiUserIcon" html-ng-click="showPopup(set)"/>
            <div class="eventDetailTooltipStyle" ng-show="evaluatePopup(set)">
                    <div ng-repeat="event in ::set.eventList track by event.event.Id">
                      <table style="width: 100%;">
                        <tr>
                            <td>
                                {{::$index + 1}}
                            </td>
                            <td>
                                Time:
                            </td>
                            <td>
                                {{::event.event["StartDateTime"] | date: "hh a"}} - {{::event.event["EndDateTime"] | date: "hh a"}}
                            </td>
                            <td ng-if="($index == 0)" align="right" ng-click="closePopup(set)">
                              Close
                            </td>
                            <td ng-if="($index != 0)">                                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                Subject:
                            </td>
                            <td>
                                {{::event.event["Subject"]}}
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td>
                                Contact Person:
                            </td>
                            <td>
                                {{::event.event["Who"]["Name"]}}
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td once-style="{'background-color': SAColourMapping[event.event['Owner']['Name']]}" style="border-top-left-radius: 4px;border-bottom-left-radius: 4px;">
                                Assigned To:
                            </td>
                            <td once-style="{'background-color': SAColourMapping[event.event['Owner']['Name']]}" style="border-top-right-radius: 4px;border-bottom-right-radius: 4px;">
                                {{::event.event["Owner"]["Name"]}}
                            </td>
                            <td>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            </td>
                            <td style="padding-top: 7px;">     
                              <div class="round" ng-if="event.event.OwnerId == scopedUser.Id">
                                      <input type="checkbox" once-id="acc.account.Id + '-' +  'colouredcheckbox-' + set.dayNumber + '-' + event.event.Id" ng-disabled="::(set.typeCol == 'Holiday' || set.readOnlySt)" ng-checked="true"/>
                                        <label ng-attr-for="{{::(acc.account.Id + '-' + 'colouredcheckbox-' + set.dayNumber + '-' + event.event.Id)}}" once-style="{'background-color': SAColourMapping[(event.event.Owner.Name)]}" ng-class="::{'disabledCheckboxClass': set.typeCol == 'Holiday' || set.readOnlySt, 'enabledCheckboxClass' : set.typeCol != 'Holiday' && !set.readOnlySt}" ></label>
                                        <span class="ahevent" ng-if="::(!event.event.WhatId.startsWith('a02'))">AH</span>
                                </div>
                                <div class="round" ng-if="event.event.OwnerId != scopedUser.Id">
                                        <input type="checkbox" once-id="acc.account.Id + '-' +  'colouredcheckbox-' + set.dayNumber + '-' + event.event.Id" ng-disabled="::(set.typeCol == 'Holiday' || set.readOnlySt)" ng-checked="false"/>
                                          <label ng-attr-for="{{::(acc.account.Id + '-' + 'colouredcheckbox-' + set.dayNumber + '-' + event.event.Id)}}" once-style="{'background-color': SAColourMapping[(event.event.Owner.Name)]}" ng-class="::{'disabledCheckboxClass': set.typeCol == 'Holiday' || set.readOnlySt, 'enabledCheckboxClass' : set.typeCol != 'Holiday' && !set.readOnlySt}"></label>
                                          <span class="ahevent" ng-if="::(!event.event.WhatId.startsWith('a02'))">AH</span>
                                  </div>
                            </td>
                            <td>

                            </td>
                            <td>
                            </td>
                        </tr>
                  </table>
              </div>
            </div>
        </div>
        <div class="round" ng-class="::{'adjustCheckboxClass': set.dayNumber >=1 && set.dayNumber <= 9, '' : set.dayNumber <1 || set.dayNumber > 9}" ng-if="::(set.eventList.length == 1 && set.eventList[0].event.OwnerId == scopedUser.Id)">
            <input type="checkbox" once-id="acc.account.Id + '-' + 'colouredcheckbox-' + set.dayNumber" ng-disabled="::(set.typeCol == 'Holiday' || set.readOnlySt)" ng-checked="true" />
              <label ng-attr-for="{{::(acc.account.Id + '-' + 'colouredcheckbox-' + set.dayNumber)}}" once-style="{'background-color': SAColourMapping[(set.eventList[0].event.Owner.Name)]}" ng-class="::{'disabledCheckboxClass': set.typeCol == 'Holiday' || set.readOnlySt, 'enabledCheckboxClass' : set.typeCol != 'Holiday' && !set.readOnlySt}" ></label>
              <span class="ahevent" ng-if="::(!set.eventList[0].event.WhatId.startsWith('a02'))">AH</span>
        </div>
        <div class="round" ng-class="::{'adjustCheckboxClass': set.dayNumber >=1 && set.dayNumber <= 9, '' : set.dayNumber <1 || set.dayNumber > 9}" ng-if="::(set.eventList.length == 1 && set.eventList[0].event.OwnerId != scopedUser.Id)">
            <input type="checkbox" once-id="acc.account.Id + '-' + 'colouredcheckbox-' + set.dayNumber" ng-disabled="::(set.typeCol == 'Holiday' || set.readOnlySt)" ng-checked="false" />
              <label ng-attr-for="{{::(acc.account.Id + '-' + 'colouredcheckbox-' + set.dayNumber)}}" once-style="{'background-color': SAColourMapping[(set.eventList[0].event.Owner.Name)]}" ng-class="::{'disabledCheckboxClass': set.typeCol == 'Holiday' || set.readOnlySt, 'enabledCheckboxClass' : set.typeCol != 'Holiday' && !set.readOnlySt}"></label>
              <span class="ahevent" ng-if="::(!set.eventList[0].event.WhatId.startsWith('a02'))">AH</span>
        </div>
        <div class="round" ng-class="::{'adjustCheckboxClass': set.dayNumber >=1 && set.dayNumber <= 9, '' : set.dayNumber <1 || set.dayNumber > 9}" ng-if="::(set.eventList.length == 0)">
            <input type="checkbox" once-id="acc.account.Id + '-' + 'greycheckbox-' + set.dayNumber" ng-disabled="::(set.typeCol == 'Holiday' || set.readOnlySt)" ng-checked="false" />
              <label ng-attr-for="{{::(acc.account.Id + '-' + 'greycheckbox-' + set.dayNumber)}}" ng-class="::{'disabledCheckboxClass': set.typeCol == 'Holiday' || set.readOnlySt, 'enabledCheckboxClass' : set.typeCol != 'Holiday' && !set.readOnlySt}"></label>
        </div>
    </td>
</tr>

更新的:
调试继续进行,我遇到了另一个Snippet,它将观察者的数量作为属性添加到每个元素:Watcher probe。这显示了&#39; tr&#39;元素本身有2个相关的未知观察者(而不是任何子元素)。所以,我想我们必须弄清楚的是为什么&#39; tr&#39;有两个额外的观察者。

0 个答案:

没有答案