latest
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<table id="bookListTable" class="table bordered highlight">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><input type="checkbox"/></th>
|
||||
<th><input type="checkbox" (change)="updateSelected($event.target.checked)" /></th>
|
||||
<th>Title</th>
|
||||
<th>Author</th>
|
||||
<th>Category</th>
|
||||
@@ -17,7 +17,7 @@
|
||||
<tr *ngFor="let book of bookList">
|
||||
<td>
|
||||
<input hidden="hidden" name="id" />
|
||||
<input type="checkbox" [checked]="checked" (change)="updateRemoveBookList($event.target.checked, book)" />
|
||||
<input type="checkbox" [checked]="allChecked" (change)="updateRemoveBookList($event.target.checked, book)" />
|
||||
</td>
|
||||
<td><a (click)="onSelect(book)" style="cursor: pointer">{{book.title}}</a></td>
|
||||
<td>{{book.author}}</td>
|
||||
|
||||
@@ -15,7 +15,9 @@ import {MdDialog, MdDialogRef} from '@angular/material';
|
||||
export class BookListComponent implements OnInit {
|
||||
|
||||
private selectedBook : Book;
|
||||
private checked:boolean;
|
||||
private bookList: Book[];
|
||||
private allChecked:boolean;
|
||||
private removeBookList: Book[]=new Array();
|
||||
|
||||
constructor(private removeBookService:RemoveBookService, private getBookListService: GetBookListService, private router: Router, public dialog: MdDialog) {
|
||||
@@ -48,7 +50,7 @@ export class BookListComponent implements OnInit {
|
||||
err => {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -63,6 +65,16 @@ export class BookListComponent implements OnInit {
|
||||
console.log(this.removeBookList);
|
||||
}
|
||||
|
||||
updateSelected(checked:boolean){
|
||||
if(checked) {
|
||||
this.allChecked=true;
|
||||
this.removeBookList=this.bookList;
|
||||
} else {
|
||||
this.allChecked=false;
|
||||
this.removeBookList=[];
|
||||
}
|
||||
}
|
||||
|
||||
removeSelectedBooks() {
|
||||
let dialogRef = this.dialog.open(DialogResultExampleDialog);
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
@@ -73,7 +85,7 @@ export class BookListComponent implements OnInit {
|
||||
},
|
||||
err => {
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
};
|
||||
location.reload();
|
||||
|
||||
Reference in New Issue
Block a user