Setting priority for a task

The fourth feature of our to-do application is to give the users the ability to set priority for tasks. We will do this by adding a dropdown with options for priority. The user will be able to select the appropriate priority when creating a task. The priority of the task will be displayed in a new column in our tasks table. The options for the priority will be 1, 2, and 3.

Let's start by adding the priority attribute to our task model. Open the ToDoList module in the todolist.js file and add the attribute to capture the priority of the task. This attribute must be an observable for two-way data binding to work. Your task model should look similar to this:

/* the task */ var task = { name: ko.observable(), description: ...

Get KnockoutJS by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.