-
-
Save EdwardIII/5076249 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var GuestView = function(){ | |
this.guestlist = ko.observableArray(ko.utils.arrayMap(tickets, function(ticket) { | |
return { | |
// How do i sync up guests and tickets, and ensure that when | |
// the num_of_guests increases, new guest input fields are created? | |
})) | |
} | |
var TicketView = function(){ | |
this.tickets = ko.observableArray() | |
}; | |
tickets = [ | |
{ name: 'With champers', price: '9.99', num_of_guests: ko.observable(0), guests: ko.observable(new Guests())}, | |
{ name: 'Meal only', price: '6.99', num_of_guests: ko.observable(0), guests: ko.observable(new Guests())} | |
] | |
ko.applyBindings(new TicketView(), document.getElementById('tickets')); | |
ko.applyBindings(new GuestView(), document.getElementById('guestlist')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment