create usercontrol using javascript or winJS or angularJS for Windows8 -


i developing windows 8.1 application using html5/javascript. need create usercontrols create in native windows application. reason:single page has code of multiple pages/modules, code cleanup , better understanding.

how create usercontrols or there other way same?

yes there possibility same. winjs has fragments can load , unload, in same manner usercontrols in windows forms. pages behave in same way, if using windows javascript template application "navigator.js"-file.

here image msdn site how navigator.js switches pages default.html

example:

in main html file define button loads fragment testing purpose , div id fragment loaded:

<div class="box">     <button class="win-button action" id="basicfragmentloadbutton">load fragment</button><br />     <div id="basicfragmentloaddiv"></div>     <br />     <div id="status"></div> </div> 

in javascript file utilize winjs.ui.fragments namespace "rendercopy" function render content of html file want use usercontrol:

// assign element variable var basicfragmentloaddiv = document.queryselector("#basicfragmentloaddiv");  function resetoutput() {     basicfragmentloaddiv.innerhtml = ""; }  function basicfragmentload() {     resetoutput();       winjs.ui.fragments.rendercopy("/pages/fragments/content/basicfragmentload.html", basicfragmentloaddiv)         .done(             function () {                 log("successfully loaded fragment", "sample", "status");             },             function (error) {                 log("error loading fragment: " + error, "sample", "error");             }         ); 

/pages/fragments/content/basicfragmentload.html includes html elements rendered main html file. can find more in fragments section in try.buildwinjs.com


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -