Last active
December 23, 2015 18:46
-
-
Save webkul/62226ccd3e49e0a5463e to your computer and use it in GitHub Desktop.
knockout.js HTML 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
<p> | |
<h1> Hello , <span data-bind="html:getName()" </span></h1> | |
</p> | |
<script type="text/javascript" | |
src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-min.js"></script> | |
<script type="text/javascript"> | |
function viewModel() | |
{ | |
this.name = 'webkul software'; | |
this.getName = function(){ | |
return 'Welcome to <i>' +this.name + '</i>.'; | |
}; | |
}; | |
var viewModel = new viewModel(); | |
ko.applyBindings(viewModel); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment