I am trying to create a simple node-express-jade app with CRUD ops on books data maintained in a javascript array. I need to provide an option to select multiple books and then delete.
For this I have provided a checkbox against each book and binded it to book.IsSelected property. However this binding isn't working. here is example:
input(type='checkbox', name='isselected', value="#{book.IsSelected}")
then on delete button click
a(href='/books/delete-multiple')
I have a route that takes the request
router.get('/delete-multiple', function(req, res){
api.deleteMultipleBooks(error=>{
if(error){
console.log(error);
}else{
res.redirect('/books');
}
})
})
in api.js:
deleteMultipleBooks: function(callback){
_.remove(books, { IsSelected: true });
callback(null);
}
Aucun commentaire:
Enregistrer un commentaire