backbone.js - Backbone Require.js Single Page App Not Working Unless Refresh -


I am using require.js with a single page backbone.js application. Before the expected envelope JS I can click on the links and the contents of the page will be loaded as expected without refreshing, but now, it will not load until I refresh the page.

Here is my index page:

  & lt; body & gt; & Lt; Header & gt; & Lt; / Header & gt; & Lt; NAV & gt; & Lt; A href = "# / 1" & gt; World & lt; / A & gt; & Lt; A href = "# / 2" & gt; Business & lt; / A & gt; & Lt; a href = "# / 3" & gt; Opinion & lt; / A & gt; & Lt; a href = "# / 4" & gt; Game & lt; / A & gt; & Lt; A href = "# / 5" & gt; Fashion & amp; Style & lt; / A & gt; & Lt; A href = "# / 6" & gt; Video & lt; / A & gt; & Lt; / Neo & gt; & Lt; Section id = "container" & gt; & Lt; / Section & gt; & Lt; Footer & gt; & Lt; / Footer & gt; & Lt ;! - Template - & gt; & Lt; Script type = "text / template" id = "validation" & gt; & Lt; H2 & gt; This is the main content & lt; / H2 & gt; & Lt; Ul id = "test" & gt; & Lt; / Ul & gt; & Lt; / Script & gt; & Lt; Script type = "text / template" id = "content article" & gt; & Lt; H2 & gt; This is a page & lt; / H2 & gt; & Lt; Ul id = "test2" & gt; & Lt; / Ul & gt; & Lt; / Script & gt; & Lt ;! - Require.js Reference - & gt; & Lt; Script src = "/ js / libs / require.js" data-key = "/ js / app.js" & gt; & Lt; / Script & gt;   

Here is my.js page. Js config:

  needed.config ({paths: {Jquery: "libs / jquery-2.1.0.min", underscore: "Libs / underscore-min", backbone: "Libby / Backbone-min ", shim: {underscore: {export:" _ "}, backbone: {Deps: ['underscore', 'jquery'], export: 'backbone'}}}}); Requirement (['Router / SiteRouter'], Function (Router) {New Router;});   

Here's my router:

  define (['underscore', 'backbone', 'view / attributes article view', 'view / content See article '], Function (_, Backbone, Featured Articles, View Content Articles) {var citroare = backbone. Router.extended ({path: {' :: 'Featured ArticSquare', '1': 'Content article view', ' 2 ':' Content article view ',' 3 ':' See content article ',' 4 ':' content article view ',' 5 ':' content article view ',' 6 ':' see content article '}}) ; Var Router Router.on ('Route: View content article', function () {new content articleview ()) = New site router (); router.n ('Route: Featured article views' function () {new featuredArticlesView ();}); router.on ;}); Backbone; history.start (); return cyturter;});  

It is fixed in my router that I had two variables and only "cyturators "Was returning. Wrap them in the function to resolve it. Define

  (['underscore', 'backbone', 'visual / featured artview', 'views / contentArticlesView'], function (_, backbone, see content article) {function routing ( ) {Var siteRouter = Backbone.Router.extend ({':' Featured article view ',' 1 ':' Content article view ',' 2 ':' Content article view ',' 3 ':' Content article See '4': 'Content article view', '5': 'content article view', '6': 'content article view'}}); var router = new site router (); router.one ('route: featured article View ', function {New featuredArticlesView ();}); router.on (' m Zarg: See content article ', function () (see new content article ();}); Backbone.history.start ();} return routing;});    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -