Javascript 从html页面http.get()数据传递参数时出现语法错误
我试图从html页面传递一个参数,以便从数据库中删除一行。 get()方法返回所有书籍的数据,我将传递某本书的id以删除它。 但它的返回synatx错误 这是一个带有delete按钮的html页面,在单击时具有函数调用Javascript 从html页面http.get()数据传递参数时出现语法错误,javascript,angularjs,angularjs-ng-click,Javascript,Angularjs,Angularjs Ng Click,我试图从html页面传递一个参数,以便从数据库中删除一行。 get()方法返回所有书籍的数据,我将传递某本书的id以删除它。 但它的返回synatx错误 这是一个带有delete按钮的html页面,在单击时具有函数调用 <div class="container"> <table class="table"> <thead> <tr> <th>Id<
<div class="container">
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>Name of Book</th>
<th>Author</th>
<th>Description</th>
<th>No of books available</th>
</tr>
</thead>
<tbody>
<tr ng-repeat = "book in libraryBooks | filter:keyword">
<td>{{book.id}}</td>
<td>{{book.name}}</td>
<td>{{book.author}}</td>
<td>{{book.description}}</td>
<td>{{book.count}}</td>
<td><button ng-click = "removeItem({{book.id}})">remove</button></td>
</tr>
</tbody>
</table>
</div>
身份证件
书名
作者
描述
可用图书数量
{{book.id}
{{book.name}
{{book.author}}
{{book.description}}
{{book.count}}
去除
这将在浏览器控制台中返回synatx错误
我正在将此参数传递给控制器中的Receive,以调用hibernate函数来删除具有该特定id的书籍您可以只传递
book.id
像这样:
<button ng-click = "removeItem(book.id)">remove</button>
删除
因为您不能在ng click
指令内使用{{}
插值指令,因为您可以直接访问ng click
指令上的范围变量
ng-click="removeItem(book.id)"
ng click是角度指令。它接受范围中的参数。所以你可以用下面这行 ng click=“removietem(book.id)”