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

Lazy loading

In some cases, you have a big amount of data, and the page loading process needs time. A good practice is loading the full page markup first and then loading big data with an additional request to the server. Knockout MVC allows you do it in an easy way.

Imagine that your library contains a large number of books. Let's consider an example with lazy loading of the book list.

The Model will be as follows:

public class BookModel { public string Title { get; set; } public string Author { get; set; } } public class LibraryModel { public bool IsLoaded { get; set; } public List<BookModel> Books { get; set; } public void LoadData() { Books = new List<BookModel>(); Books.Add(new BookModel { Title = "Oliver Twist", Author = "Charles Dickens" }); ...

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