How to call multiple methods on a button click using Angular 5?

后端 未结 3 2065
北海茫月
北海茫月 2021-02-19 21:06

i am using angular 5 and facing a problem. i want to submit (click) event and call two or multiple method one bye one. Please give me idea or solution so that i can submit a (c

相关标签:
3条回答
  • 2021-02-19 21:17

    This is the correct way I guess. It is working for me.

    <button (click)="abc(); bcde()"></button>
    
    0 讨论(0)
  • 2021-02-19 21:21

    you can also do

    <button (click)="[abc(), bcde()]"></button>
    
    0 讨论(0)
  • 2021-02-19 21:41
    <button (click)="callall()"></button>
    

    make one function and call all the function in that

    function 1

    abc(){}
    

    function 2

    bcde(){}
    

    call both in common function

     callall(){
    
            this.abc()
            this.bcde() 
    }
    
    0 讨论(0)
提交回复
热议问题