开发者

Backbone js confusion

开发者 https://www.devze.com 2023-04-08 18:08 出处:网络
I have heard a lot about backbone.js and quite frankly I don\'t understand its concept. Does it require that all the elements should be in single page to work out with its animations and effects ? Or

I have heard a lot about backbone.js and quite frankly I don't understand its concept. Does it require that all the elements should be in single page to work out with its animations and effects ? Or it can grab items from server and load it with transition or i mean different pages but make look like a single page. I didn't understand its concept well, so that's why i am asking. What i am looking for is to combine ba开发者_如何转开发ckbone or any other javascript framework to work with a rails project, that could give some ease transition across pages and can give native application look.


Backbone is also here to give you structure by being MVC, and it allows to communicate in a really simple way with the server. You'll be able to update / fetch / save your data (your rails models for example) on the server. So you'll need it if you want your user to work on an Ajax page without having to reload the page.

For example, you'll fetch all your data from the server when the page loads and then you'll have access to all attributes of your models and will be able to modify it and save it to the server.

Moreover, if you want your models to appear with transition, as Backbone is MVC, you'll be able to make that easily. As you have to choose when and where your views will appear on the DOM, you'll be able to put transition at that time.

By the way, Backbone works really great with Rails!


Backbone.js is all about data to be used in some way from your users, think about it as ActiveRecord plus Sinatra (or rails) on a browser, infact, the framework will give you a way to handle your data inside a browser instead of the server.

If you are looking for a simple way to add transitions to your existing app/website you could use a jquery plugin like Pagify (it rely on $.getHtml()) modifying it to get a fragment of the subpages like my (buggy) fork.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号