Broadcast from Angular to a jQuery Listener

前端 未结 2 1482
清歌不尽
清歌不尽 2021-01-17 21:05

Trying to get AngularJS to broadcast a custom event that jQuery is listening for.

In the jQuery I have something similar to this:

$( document ).on( \         


        
2条回答
  •  旧巷少年郎
    2021-01-17 21:40

    I've got to be a nay-sayer; don't do this. What you are doing, modifying the DOM based on an event, is literally what angular was built for. Bringing jQuery into the picture is unnecessary, and only adds complication. Look into ng-bind and ng-model to see how to update the DOM in response to your data changing.

提交回复
热议问题