Created
June 17, 2013 22:57
-
-
Save Jorgelig/5801250 to your computer and use it in GitHub Desktop.
Custom bindings for add script tag
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
(function($) { | |
ko.bindingHandlers.script = { | |
update: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) { | |
var options = ko.utils.unwrapObservable(valueAccessor()); | |
if(options.path != ''){ | |
$(element).html("<script src='" + options.path + options.parameters + "'></script>"); | |
} | |
} | |
}; | |
})($); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment