search

Home  >  Q&A  >  body text

javascript - angular gets data from the background and renders the table, "No data yet" when there is no data

 var form = document.getElementById("table");
 form.find('tbody').append('<tr><td>暂无数据</td></tr>');

Always reporting error find is not a function
Yes, I have introduced jquery

阿神阿神2786 days ago672

reply all(1)I'll reply

  • 学习ing

    学习ing2017-06-26 10:57:22

    Look at this document.getElementById("table"),
    Here we use native js to get a dom element and then call the find method
    and find is the method of the jQuery instance. So an error will be reported.
    can be modified to the following code:

    $('#table tbody').append('<tr><td>暂无数据</td></tr>');

    Or use ng-if|ngIf to bind data in the view layer to display

    reply
    0
  • Cancelreply