我正在開發一個有角度的頁面。我對角度不太熟悉。我花了幾個小時來研究它,并瀏覽了有關此問題的最大數量的備用線程。但找不到我正在研究的解決方案。具體來說,我想在這里強調我正在使用引導復選框。我沒有使用 ng-bootstrap。以下是我想解決的問題。當頁面加載時,按鈕應該被禁用,直到我單擊復選框。當我單擊表標題中的復選框時,它應該啟用表中的所有復選框并啟用按鈕。當我取消選中標題中的復選框時,它應該禁用所有其他復選框并禁用按鈕。以下是我為解決問題所做的詳細信息。我的頁面.html <div id='bookstore'> <table class="table table-responsive table-striped"> <thead class="th-color"> <tr> <th><input name="select_all_books" type="checkbox" ></th> <th class="theading">Book ID</th> <th class="theading">Book Name</th> <th class="theading">From Date</th> <th class="theading">To Date</th> <th class="theading">No of Days</th> <th class="theading">Apply Date</th> <th class="theading">Reason</th> <th class="theading">Book Status</th> </tr> </thead> <tbody> <tr *ngFor="let data of bookstore | paginate: { itemsPerPage: pageSize, currentPage: p}"> <td><input type="checkbox" id="rowcheckedbookstore"></td> <td> {{data.BookId }}</td> <td>{{ data.BookName }}</td> <td>{{ data.BookStart | date:'dd-MM-yyyy' }}</td> <td>{{ data.BookReturn | date:'dd-MM-yyyy' }}</td> <td>{{ data.BookDays }}</td> <td>{{ data.ApplyDate}}</td> <td>{{ data.Reason }}</td> <td>{{ data.BookStatus}}</td> </tr> </tbody> </table> </div>我可以禁用頁面加載上的按鈕。但當我嘗試使用復選框時,我無法實現。我想知道我怎樣才能實現?
在表中如何使用角度 9 中的按鈕啟用和禁用 Bootstrap 復選框?
一只甜甜圈
2023-10-14 15:45:02