Last active
August 29, 2015 14:10
Revisions
-
rshackleton created this gist
Aug 19, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ 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; } );