javascript - I think I am not using Backbone JS's views correctly? -


I have just started using backbone (and underscore) JS. I am applying a big iPad HTML5 and It needs to do all the client side work. The structure of the project is needed and the backbone seems a good fit. It seems that there is not too much on the way and can be used as a bit of toolkit (especially because underscores are also required).

I have a question, though. This HTML5 app is basically a page application, everything starts with an index.html file. I know the basic way of managing pieces of URL, which I like. It is easy to set up routing events for specific models.

There are about 3 levels of nesting in this HTML5 app in the many "Nespace Layers" that I am working on, this is JSON data, which uses this app ( I do not have to go to local database memory yet, but maybe I want to? Just wanted to take my head around the backbone). They are common webpages, for example, they are just pages of content that are loading in different parts of the webpage.

I am using ideas. I think I have the concept ... Collect a collection with data and the view is built around the collection of this data. I think there is a view to go with it for an example of the model. Then when you want to see the collection of models, you can call on a view that will be repeated on the collection and call the view of each individual model.

Sorry, I know that I probably do not understand much!

But basically, I see that backbone view is used to generate HTML for a model for the collection of a model ... so that the pages were resolved for different parts Have all the little ideas, but for a whole page about a scene? This HTML5 app is called a basic template, but different pages on the webpage require different page layouts, so they can see how they should be. Can you talk like this? Basically there is a scene that makes an Ajax call to get a full-page template?

The example below is a sequence that is called the main creator, when the url is in the root of the app. There are many ideas like this that I want to set up, in which the user will need to show up on various URLs. Is it wrong to load in the entire Ajax template like I am here? What are the other ways for a single page application for all different pieces of site, but there are also manageable page templates?

  App.View.Home = Backbone.View.extend ({tagName: "article", id: "view-home", start: function () {_.bindAll (" Render ");}, render: function () {var that = this; $ .get (" templates / home.html ", function (template html) {$ (that .al). Html (_ template (template html) ); // We want the tabs in this template, too many tabs = new app.view tabs (); $ (That.el) .find ('# main') .html (tabs.render (). El) ;}, "Html") ;;;};} ;;;   

I'm sorry if it does not matter much ... I'm trying to learn a lot

I do not really think anything wrong in this approach, but without seeing a bit more code It is difficult to say the important thing is that the spinal cord is not very high. There are only a few things that are designed to carry the spinal cord, and beyond that it depends on you to take advantage of the functionality. Based on this.

This special Is I do not see any reason for the issue of what you're doing here, I will definitely make sure that you are not loaded before loading / loading any data or templates. I will also make sure that wait until you have all the data you need before presenting any data (do not load this view with thieves). These last points are only guideline and in fact there is nothing with spinal cord but honestly it is one of the backbone features : it does some things well and then from your way Turns out

Comments