javascript - Winjs Navigate from PageControl doesnt fire ready event -
im learning build windows 8.1 navigation app in visual studio express 2013.
ive created button inside home.html , binded click event perform navigation pagecontrol element called htmlcontrols (the navigation works fine). next ive created new pagecontrol named otherpage , i´ve added button time inside htmlcontrols. bindend click event button navigate htmlcontrols other page.
the navigation flow should be:
home (click)-> htmlcontrols (click)-> otherpage
the second navigation doesnt work, ive tried put debugger inside ready event on otherpage.js doesnt fire.
im completly lost!
htmlcontrols.html:
<!doctype html> <html> <head> <meta charset="utf-8" /> <title>htmlcontrols</title> <link href="htmlcontrols.css" rel="stylesheet" /> <script src="htmlcontrols.js"></script> </head> <body> <div class="htmlcontrols fragment"> <header class="page-header" aria-label="header content" role="banner"> <button class="back-button" data-win-control="winjs.ui.backbutton"></button> <h1 class="titlearea win-type-ellipsis"> <span class="pagetitle">welcome htmlcontrols</span> </h1> </header> <section class="page-section" aria-label="main content" role="main"> <button id="newbutton">link page!</button> </section> </div> </body> </html> htmlcontrols.js:
// introduction page control template, see following documentation: // http://go.microsoft.com/fwlink/?linkid=232511 (function () { "use strict"; var nav = winjs.navigation; winjs.ui.pages.define("/pages/htmlcontrols.html", { // function called whenever user navigates page. // populates page elements app's data. ready: function (element, options) { // never reaches point debugger; newbutton.addeventlistener("click", function (e) { nav.navigate("/pages/otherpage/otherpage.html"); }, false); }, unload: function () { // todo: respond navigations away page. }, updatelayout: function (element) { /// <param name="element" domelement="true" /> // todo: respond changes in layout. } }); })();
found it! in htmlcontrols.js, uri in winjs.ui.pages.define() wrong.
Comments
Post a Comment