Object JavaScript - Knockout Control Flow using with binding
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<h1 data-bind="text: product"></h1> | |
<p data-bind="with: warehouse"> | |
Warehouse Location: <span data-bind="text: location"></span>, | |
Quantity Available: <span data-bind="text: quanAvail"></span> | |
</p> | |
<script src="Scripts/knockout-2.2.1.debug.js"></script> | |
<script type="text/javascript"> | |
ko.applyBindings({ | |
product: "Widget", | |
warehouse: { | |
location: "3D1", | |
quanAvail: 6 | |
} | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment