html - Page navigation - jQuery Mobile with knockout.js -


I am working with a cross-platform mobile application using jQuery Mobile and Knockout. I should know the proper way to redirect to the next page I have seen that all the examples represent a single HTML file with multiple pages. Is it possible to create separate HTML files for each page, and it is possible to maintain a personal JS file for each HTML page. Also, how do I add a visual model to each individual page?

My questions are as follows ...

  1. How can I redirect from index.html from Search.html and pass data between those pages?
  2. How do I create personalized HTML for each page and link to the visual model?

Example of working code

Index.html

& lt; Div data-role = "page" id = "index" & gt; & Lt; Div data-role = "header" & gt; & Lt; H1 & gt; JQM & lt; / H1> & Lt; / Div & gt; & Lt; Div data-role = "content" data-axol & gt; This is a jQM test & lt; Label = "arrCity" & gt; & Lt; / Labels & gt; & Lt; Input type = "text" class = "autocomplete" data-bind = "value: acety" /> & Lt; Div data-bind = "ac" & gt; & Lt; / Div & gt; & Lt; Input ID = "BTN" type = "button" data-bind = "click: sodata" value = "showData" /> & Lt; / Div & gt; & Lt; Div data-role = "footer" & gt; & Lt; H1 & gt; JQM Footer & lt; / H1> & Lt; / Div & gt; & Lt; / Div & gt;

search.html

  div id = "second" data-role = "page" & gt; & Lt; Div data-role = "header" & gt; & Lt; H1 data-bound = "text: greeting" & gt; & Lt; / H1> & Lt; / Div & gt; & Lt; / Div & gt;  

Index.js

  $ (document) .ready (function () {ko.applyBindings (ReqModel, Document GetElementById) ('Index'));}); Var Rikmodel = new recodel (); Fictitious arithmetic () {this.aCity = ko.observable (''); This.showData = function () {warning (this.aCity ()); $ .mobile.changePage ("search.html"); }; }  

search.js

  var ResviewModel = New ResviewModel (ReqModel); Function ResviewModel (data) {warning ("this load"); } $ (Document) .ready (function () {var pre = document.getElementById ('index'); ko.cleanNode (pre); ko.applyBindings (ResviewModel, document.getElementById ('second'))}; < / Code> 

Regarding your first question:

I How can I redirect search.html from index.html and pass data between those pages?

I resolved this problem, (but also available) I hope Will that help?


Comments