February 2015
Intermediate to advanced
232 pages
4h 40m
English
Finally, we need to update the events/cart.js file. The confirm order event needs to update the view-model. We can require the viewmodel as a dependency and access its public interface:
define([ 'jquery','viewmodel','services/CartProductService' ], function(vm, CartProductService) { "use strict"; $(document).on("click","#confirmOrderBtn", function() { vm.showOrder(); }); $(document).on("click", ".add-unit", function() { var data = ko.dataFor(this); $(document).trigger("addUnit",[data]); }); $(document).on("click", ".remove-unit", function() { var data = ko.dataFor(this); $(document).trigger("removeUnit",[data]); }); $(document).on("addUnit",function(event, data){ CartProductService.addUnit(data); }); $(document).on("removeUnit",function(event, ...
Read now
Unlock full access