O'Reilly logo

Getting Started with Knockout.js for .NET Developers by Andrey Akinshin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required