I'm trying to make my form clear itself after submitting an entry to my database, following this tutorial . This is my code:
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.