請?jiān)忂@里的任何關(guān)鍵術(shù)語錯(cuò)誤。盡管我的英語很好,但我還是用我的母語學(xué)習(xí)了編程。我有一個(gè)使用 Bootstrap 運(yùn)行最新版本 Angular 的項(xiàng)目。我不知道這在這里是否有所作為,我真的很困惑。我的組件中有兩個(gè)獨(dú)立的模態(tài)。其中之一包括一個(gè)用于將一些數(shù)據(jù)注冊到我的數(shù)據(jù)庫的表單,并且有一個(gè)按鈕綁定了一個(gè)函數(shù)以保存所有數(shù)據(jù)。它看起來像這樣:<div class="modal fade" id="addTaskModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Submit a new task</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form [formGroup]="taskForm" class="form-group"> <!-- Form data and whatnot is in here --> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <input type="button" value="Submit Task" class="btn btn-primary" (onclick)="submitTask()"> <!-- ^^ This button is not running correctly --> </div> </div> </div></div>我的打字稿看起來像這樣 submitTask() { console.log("test"); }它甚至不會登錄到控制臺。通常當(dāng)我調(diào)用一個(gè)沒有在我的打字稿組件中聲明的函數(shù)時(shí),頁面不會呈現(xiàn)并返回一個(gè)錯(cuò)誤,這很好。我嘗試將函數(shù)的名稱更改為不存在的名稱,但出于某種原因我沒有收到錯(cuò)誤。我的 VS Code 控制臺出現(xiàn)錯(cuò)誤,但頁面仍然呈現(xiàn)并且工作正常。我做錯(cuò)了什么是顯而易見的嗎?或者只是我不能在一個(gè)頁面上有兩個(gè)模式,盡管那根本沒有意義?
為什么這個(gè)函數(shù)沒有運(yùn)行?
慕雪6442864
2022-12-09 16:59:50