Meteor:使用Angular2提交后的清晰表格

时间:2017-12-22 00:03:13

标签: javascript mongodb angular forms meteor

在我tutorial之后提交数据库条目后,我正在努力使表单自行清楚。这是我的代码:

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 = '';
}

1 个答案:

答案 0 :(得分:0)

这是一个错字,应该是

ctrl not crtl
相关问题