角色事件,ng点击,不适用于其他库Dojo,Knockout,KendoUI,ESRI JSAPI [英] Angular events, ng-click, do not work with other libraries Dojo, Knockout, KendoUI, ESRI JSAPI
问题描述
继续此帖 - 为什么ng点击不起作用?
所以我处于将Angular应用程序转换成Angular的早期阶段。我们没有给出清理重写的选项。
So I am in the early phases of converting a non-Angular application to Angular. We have not been given the option to do a clean re-write.
此应用程序使用Dojo,require.js,Knockout,ESRI JSAPI和KendoUI。在这里使用简单的代号:
This application uses Dojo, require.js, Knockout, ESRI JSAPI, and KendoUI. Using the simple plunker code here:
https://plnkr.co/edit/kK3NmWB9wfOopG7m5MYv?p=preview
$scope.myClick
没有从这个其他应用程序中调用。
does not get called from within this other application.
我已经确定,根据Angular应用程序放置在index.html文件中的位置,这会影响Angular点击和按键,也可能会影响其他事件。如果我在任何其他代码之前将应用程序放在HTML中,这将开始工作。
I have determined that depending on where the Angular app is placed in the index.html file, this affects Angular click and keypress, and probably other events. If I place the app in the HTML before any of the other code, this starts working.
tl; dr
或任何有关如何隔离角色代码的想法从现有的非Angular应用程序?
tl;dr Or any ideas on how to isolate Angular code from an existing non-Angular application?
谢谢
推荐答案
希望这有助于任何有类似问题的人 -
Hope this helps anyone who has a similar problem -
原来,这段代码是影响角度事件的:
Turns out, this code was what was affecting the angular events:
<!--ko if: someContext.ready() === true-->
<div class="ls-rapidReports">
<div ng-app="myApp">
<div id="rapidreportCtrl" ng-controller="rrController">
<button type="button" ng-click="myClick()">hehe</button>
</div>
</div>
</div>
<!--/ko-->
所以在Knockout中包装角部件是BAD。
So wrapping Angular components inside Knockout is BAD.
这篇关于角色事件,ng点击,不适用于其他库Dojo,Knockout,KendoUI,ESRI JSAPI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!