How to bind custom events in AngularJS?

后端 未结 2 656
小鲜肉
小鲜肉 2021-01-12 20:13

I have an custom event core-transitionend (actually fired by Polymer), and I can set an event handler using document.addEventListener(). But what\'

2条回答
  •  自闭症患者
    2021-01-12 20:33

    You could do the following:

    1. Wrap your custom element inside an auto-binding template.
    2. Bind all handlers from angular scope to polymer scope (template element).

    And that's it!

    
    
    
    
    
                
                {[{text}]}
                
                

    Or if it's not an issue to copy the whole scope you can:

        
        
    
        
        
                    
                    {[{text}]}
                    
                    

    Notice: that I had to change Angular's interpolation symbol to get them to work together.

提交回复
热议问题