0

I am new to angular js and I have achieved this functionality using jquery code and now I want it to get converted to angularjs code

$("#addRow").click(function () {
    $("#myTable").each(function () {
        var tds = '<tr>';
        jQuery.each($('tr:last td', this), function () {
            tds += '<td contenteditable="true"></td>';
        });
        tds += '</tr>';
        $('tbody', this).append(tds);
    });
}); 
2
  • 1
    you should describe what you want to do instead. Sometimes you can have a simple solution without any similarities with jQuery code, since DOM manipulations is not needed most of the time Commented Nov 16, 2018 at 9:42
  • 1
    The angular way to do this kind of things would be to use ng-repeat="item in items" in your view to construct your table rows, items being an array in your controller. Then to add a new table row, you would simply add a row in your controller array. You have several examples in SO for that, for example in this post Commented Nov 16, 2018 at 9:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.