search

Home  >  Q&A  >  body text

javascript - Please tell me how to get the data of the current row in the table in angular1.x (that is, how to get the DOM in angular)

As shown in the figure, there is such a table. The data in the table are requested from the server and written into the table using ng-reapeat {{}}. Now I want to realize that when the 退房 button is clicked, 当前行’s dataalert comes out. (That is, there are many rows of such data in the table, and you can get the data in the corresponding row by clicking the 退房 button in different rows).

If you use jquery to get DOM and print it out text.
But there is no way to start using angular thinking.
I just learned to use angular as a newbie. I hope you can provide some ideas or implementation methods. Thank you very much!

阿神阿神2841 days ago652

reply all(1)I'll reply

  • 巴扎黑

    巴扎黑2017-05-15 17:16:16

    ng-click事件添加scope内function。ng-repeatWith $index parameter, pass $index into the trigger function of ng-click event, and you can alert if you find the corresponding data in the controller.

    reply
    0
  • Cancelreply