-
-
Save ainsofs/158ffc99c80a4a02b0b2 to your computer and use it in GitHub Desktop.
DNN Knockout Boiler Template
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
<!-- requires DNN 7.2 or higher --> | |
<%@ Register TagPrefix="dnn" TagName="JavaScriptLibraryInclude" Src="~/admin/Skins/JavaScriptLibraryInclude.ascx" %> | |
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %> | |
<asp:Panel ID="ScopeWrapper" runat="server"> | |
<!-- things to bind here --> | |
</asp:Panel> | |
<dnn:JavaScriptLibraryInclude runat="server" Name="knockout" version="3.1.0" /> | |
<dnn:JavaScriptLibraryInclude runat="server" Name="knockout.mapping" version="2.4.1" /> | |
<dnn:DnnJsInclude runat="server" FilePath="/desktopmodules/[moduleName]/path/to/viewModel.js" /> | |
<script type="text/javascript"> | |
//requires jquery | |
(function($) { //remove from global scope | |
$(function() { | |
ko.applyBindings(new viewModel, document.getElementById(<%= ScopeWrapper.ClientID %>); | |
}); | |
})(jQuery); | |
</script> |
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
//Sometimes you need to use this | |
<%@ Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %> | |
//instead of | |
<%@ Register Assembly="DotNetNuke.Web" Namespace="DotNetNuke.Web.UI.WebControls" TagPrefix="Portal" %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment