Handling templates with if and ifnot bindings
You have learned how to show and hide templates with the power of jQuery and Bootstrap. This is quite good because you can use this technique with any framework you want. The problem with this type of code is that since jQuery is a DOM manipulation library, you need to reference elements to manipulate them. This means you need to know over which element you want to apply the action. Knockout gives us some bindings to hide and show elements depending on the values of our view-model. Let's update the
hide methods and the templates.
Add both the control variables to your view-model and expose them in the
var visibleCatalog = ko.observable(true); var visibleCart = ko.observable(false); ...