Last active
August 29, 2015 14:10
-
-
Save valerysntx/c2bfe73a4783b9ebc99a to your computer and use it in GitHub Desktop.
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
define(['jquery', 'knockout', 'knockout.mapping', 'knockout.validation'], | |
function ($, ko) { | |
/** The module. */ | |
var self = {}; | |
/** The knockout view model. */ | |
self.viewModel = {}; | |
/** The knockout container. */ | |
self.container = null; | |
/** Initialise the module. */ | |
self.initialise = function (container) { | |
self.container = container; | |
// Call API end point. | |
$.getJSON('/API/End/Point', | |
function (json) { | |
self.viewModel = ko.mapping.fromJS(json); | |
extendViewModel(); | |
var context = ko.contextFor(self.container); | |
if (context === undefined) | |
ko.applyBindings(self.viewModel, self.container); | |
} | |
); | |
}; | |
/** Extend the view model. */ | |
var extendViewModel = function () { | |
}; | |
return self; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment