jose.samb...@gmail.com
unread,Jul 27, 2013, 8:26:33 AM7/27/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to knock...@googlegroups.com
Hi group,
I m new in Knockout , i have dowloaded it the library and try first example but i don't get to work , i m copying the entire script so you can take a look at it and see what i m doing wrong
<html>
<head>
<script type='text/javascript' src="scripts/jquery-1.10.2.min.js"></script>
<script type='text/javascript' src="scripts/knockout-2.3.0.js"></script>
<script type='text/javascript'>
var ViewModel = function(first, last) {
this.firstName = ko.observable(first);
this.lastName = ko.observable(last);
this.fullName = ko.computed(function() {
// Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called when evaluating fullName.
return this.firstName() + " " + this.lastName();
}, this);
};
ko.applyBindings(new ViewModel("Planet", "Earth"));
</script>
</head>
<body>
<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>
<h2>Hello, <span data-bind="text: fullName"> </span>!</h2>
</body>
</html>