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.
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; using DelegateDecompiler; using Newtonsoft.Json; namespace HelloWorld.Models { public class HelloWorldModel { public string FirstName { get; set; } public string LastName { get; set; } [Computed] [ScriptIgnore...