Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying KNOCKOUTJS BLUEPRINTS
  • Table Of Contents Toc
KNOCKOUTJS BLUEPRINTS

KNOCKOUTJS BLUEPRINTS

By : Carlo Russo
5 (1)
close
close
KNOCKOUTJS BLUEPRINTS

KNOCKOUTJS BLUEPRINTS

5 (1)
By: Carlo Russo

Overview of this book

If you are a JavaScript developer and already know the basics of KnockoutJS and you want to get the most out of it, then this book is for you. This book will help in your transition from a small site to a large web application that is easily maintainable.
Table of Contents (7 chapters)
close
close
6
Index

Getting jQuery because it can be useful

In the previous section, we put the data directly inside the View Model; this was just to show how the ViewModel works. In any normal application the source of your data is online and you get it by calling a remote service.

Anyway, as you can see if you look at the documentation of KnockoutJS, the library doesn't provide you any help to take the data. We could use plain JavaScript to do this; but to make it a little easier, we will be using jQuery to deal with our AJAX request in the rest of the book.

Browser compatibility

One of the most relevant features of KnockoutJS is its browser compatibility; it even works on ancient browsers, so you can use it if you need to support them.

When you develop a big application to be used online you have to decide which browser you're going to support; the main reason is that each browser you decide to support means:

  • Testing on it
  • Checking if your code/style sheet/HTML page can be supported, and how

For this reason, many big companies keep an eye on the browser market share data; it helps you to decide if it's time to drop support for a particular browser.

I mentioned this here because we are going to use jQuery. This library is different from KnockoutJS, because you must choose between two branches: 1.x and 2.x.

The main difference here is the compatibility; if you want to support all the browsers KnockoutJS supports you have to download the 1.x branch, otherwise you can choose 2.x.

Note

For these chapters, we will use the 1.x branch (we will use 1.11.1). You can download the latest jQuery library here: http://code.jquery.com/jquery-1.11.1.min.js.

After you download it, save it as SimpleShowCase/js/jquery.js.

Then update the index page to include it before the row where we included KnockoutJS:

    </div>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/knockout.js"></script>
Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
KNOCKOUTJS BLUEPRINTS
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon