How to bind jquery events in my view

后端 未结 1 597
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 14:12

I\'d like to use some third party libraries that are based on jquery with ember. This library binds event on element like this :

$(\'#an-id\')
    .bind(\'anEven         


        
相关标签:
1条回答
  • 2021-02-05 14:37

    Use the didInsertElement callback on a view, which gets invoked when the views has been added to the DOM. You can then access the added element via this.$().

    App.MyView = Em.View.create({
        didInsertElement: function() {
            this.$().bind('anEvent', ...);
        }
    });
    ​
    
    0 讨论(0)
提交回复
热议问题