Working with the Hello World example in Knockout MVC

Let's create an application based on a very simple model. It will contain only two properties: FirstName and LastName. The View will contain two TextBox elements to edit properties and a span element with a greeting text. You can find the full code of the example in the supplement code bundle of this book (HomeLibrary/HelloWorld) or look for the live example on the official site (http://knockoutmvc.com/HelloWorld).

Let's create a new ASP.NET MVC 4 project and install the kMVC packages via NuGet.

Adding the model

First of all, we should create a model. We will work with a very simple example. Let's define the following model (HelloWorld/Models/HelloWorldModel.cs):

using System.Web.Script.Serialization; ...

Get Getting Started with Knockout.js for .NET Developers 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.