Created
July 17, 2012 16:35
-
-
Save motowilliams/3130492 to your computer and use it in GitHub Desktop.
Knockout ViewModel
This file contains hidden or 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
$(function() { | |
var viewModel = function() { | |
var self = this; | |
self.address = ko.observable("Portland"); | |
self.list = ko.observableArray(); | |
self.hasData = function(){return self.list().length > 0;}; | |
self.search = function() { | |
self.list.push({ addr: "Item01" , index: 1 }); | |
self.list.push({ addr: "Item02" , index: 2 }); | |
self.list.push({ addr: "Item03" , index: 3 }); | |
}; | |
}; | |
var vm = new viewModel(); | |
ko.applyBindings(vm); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment