From 4e774c2585af584c6d57a1a1fa7dc5cbd6f1f397 Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Thu, 27 May 2021 02:03:06 +0000 Subject: [PATCH] chap1->The view-model->The view --- ko-cart/index.html | 22 ++++++++++++++++++++++ ko-cart/js/viewmodel.js | 9 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 ko-cart/js/viewmodel.js diff --git a/ko-cart/index.html b/ko-cart/index.html index 6d100b7..8bd5644 100644 --- a/ko-cart/index.html +++ b/ko-cart/index.html @@ -6,8 +6,30 @@ +
+
+
+ +

Product

+
+ ID: +
+ Name: +
+ Price: +
+ Stock: + +
+
+
+
+ + + + diff --git a/ko-cart/js/viewmodel.js b/ko-cart/js/viewmodel.js new file mode 100644 index 0000000..63f9805 --- /dev/null +++ b/ko-cart/js/viewmodel.js @@ -0,0 +1,9 @@ +var vm = { + product: { + id: 1, + name: 'T-Shirt', + price: 10, + stock: 20 + } +}; +ko.applyBindings(vm); \ No newline at end of file