javascript - Using angular expression in html onclick attribute -
i using angular build table me dynamically. expression user.user.id
needs listed out integer in each place use , works everywhere except inside html script tag using. there throws error in javascript. i'm sure there better way i'm doing here, i'm looking quick , simple solution display user id can referenced script tag.
here code:
<table class="table" ng-hide="loading" > <tr> <th>test search code</th> <th>test current company</th> <th>name</th> <th>email</th> <th>created</th> <th></th> </tr> <tr ng-repeat="user in users | filter:searchtext "> <!-- these references work fine --> <td>{{user.user.mapped_test_search_code}}</td> <td>{{user.employment[0].name}}</td> <td>{{user.user.mapped_first_name}}</td> <td>{{user.user.mapped_email}}</td> <td>{{user.user.created}}</td> <td><a href="/admin/mapped_users/edit/{{user.user.id}}"><span class="glyphicon glyphicon-pencil"></span></a></td> <td> <!-- 1 works too--> <form action="{{'/admin/users/delete/' + user.user.id}}" name="post_{{user.user.id}}" id="post_{{user.user.id}}" style="display:none;" method="post" class="ng-pristine ng-valid"> <input type="hidden" name="_method" value="post"> </form> <!-- 1 in tag, in script attribute not work --> <a href="#" class="btn btn-block" onclick="if (confirm("are sure?")) { document[ 'post_' + user. user.id ].submit(); } event.returnvalue = false; return false;" original-title=""> <span class="glyphicon glyphicon-trash"></span> </a> </td> </tr> </table>
Comments
Post a Comment