Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Knockout.JS Essentials

You're reading from   Knockout.JS Essentials Implement a successful JavaScript-rich application with KnockoutJS, jQuery, and Bootstrap

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781784397074
Length 232 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Preface 1. Refreshing the UI Automatically with KnockoutJS FREE CHAPTER 2. KnockoutJS Templates 3. Custom Bindings and Components 4. Managing KnockoutJS Events 5. Getting Data from the Server 6. The Module Pattern – RequireJS 7. Durandal – The KnockoutJS Framework 8. Developing Web Applications with Durandal – The Cart Project Index

Installing components

To develop our real-world project, we need to install a few components and set up our first layout.

These are all the components you need to download:

Since we just work on the client side in the first chapters, we can mock data in the client and will not need a server side for now. So we can choose any place in our computer to start our project. I recommend you use the environment you usually employ to do your projects.

To start, we create a folder called ko-cart and then create three folders and a file inside it:

  1. In the css folder, we will put all our css.
  2. In the js folder, we will put all our JavaScript.
  3. In the fonts folder, we will put all the font files needed by the Twitter Bootstrap framework.
  4. Create an index.html file.

Now you should set up your files the same way as shown in the following screenshot:

Installing components

The initial folder structure

Then we should set the content of the index.html file. Remember to set all the links to the files we will need using the <script> and <link> tags:

<!DOCTYPE html>
<html>
<head>
  <title>KO Shopping Cart</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
</head>
<body>
  <script type="text/javascript" src="js/vendors/jquery.min.js">
  </script>
  <script type="text/javascript" src="js/vendors/bootstrap.min.js">
  </script>
  <script type="text/javascript" src="js/vendors/knockout.debug.js">
  </script>
</body>
</html>

With these lines of code, we have all we need to start our application.

You have been reading a chapter from
Knockout.JS Essentials
Published in: Feb 2015
Publisher:
ISBN-13: 9781784397074
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image