[英]Meteor: Clear form after submit using Angular2
在按照本教程的要求向數據庫提交條目后,我試圖使自己的表單保持清晰。 這是我的代碼:
HTML:
<form class="new-task" ng-submit="$ctrl.addTask($crtl.newTask)";>
<input ng-model="$crtl.newTask" type="text" name="text" placeholder="Type to add new tasks" minlength="1"/>
</form>
JS:
addTask(newTask) {
// Insert a task into the collection
Tasks.insert({
text: newTask,
createdAt: new Date
});
// Clear form
this.newTask = '';
}
這是一個錯字,應該
ctrl not crtl
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.