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
KNOCKOUTJS BLUEPRINTS

You're reading from   KNOCKOUTJS BLUEPRINTS Learn how to design and create amazing web applications using KnockoutJS

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher
ISBN-13 9781783980840
Length 218 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Carlo Russo Carlo Russo
Author Profile Icon Carlo Russo
Carlo Russo
Arrow right icon
View More author details
Toc

Adding the Hotel Cards

Now we can develop the Hotel Cards.

As you can see in this wireframe, this component is almost self-contained, so it's normal to realize it with another component.

Adding the Hotel Cards

This component will be much shorter than the previous one because we are not going to put too much effort into it; the main reason is that we get the information to show from the backend, and we just draw it here.

The hardest part here is the HTML and the CSS behind, but we are not so interested in such code in this case.

As the first step, we will create the View Model of this new component, putting this code in BookingOnline/app/components/hotelCard.js:

define(function(require) {
  var ko = require("knockout"),
      template = require("text!./hotelCard.html");
  require("binding-handlers/button");

We will use the button binding handler to improve the style of our Booking buttons:

  function HotelCard(data) {
    ko.utils.extend(this, data);

We will then extend this object with...

You have been reading a chapter from
KNOCKOUTJS BLUEPRINTS
Published in: Feb 2015
Publisher:
ISBN-13: 9781783980840
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