Last active
October 13, 2015 22:18
-
-
Save carolynvs/4264028 to your computer and use it in GitHub Desktop.
Initializing Knockout.js Observables
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
var valueType = true; | |
var oValueType = new ko.observable(valueType); | |
oValueType(false); | |
// valueType is unchanged | |
var array = [1, 2, 3]; | |
var oArray = new ko.observableArray(array); | |
oArray.remove(1); | |
// array is modified, now equals [2, 3] | |
var date = new Date(); | |
var oDate = new ko.observable(date); | |
oDate().clearTime(); | |
// date is modified and the time portion has been removed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment