admin管理员组文章数量:1291008
There's no documentation for Backbone.history.loadURL on backbone.js website Although I have a general idea what result it produces in some applications I've looked at, I'm not exactly sure how it works, in the sense of which url it chooses to load and how it knows to load a certain url over another. Can anyone explain?
$.ajax({
url: "json/Backboneapp_data.json",
dataType: 'json',
data: {},
async: false,
success: function (data)
{
_this._data = data;
_this._items = new ItemCollection(data);
_this._view = new MenuView({ model: _this._items });
_this._view.render();
Backbone.history.loadUrl();
}
});
There's no documentation for Backbone.history.loadURL on backbone.js website http://backbonejs/#History-start Although I have a general idea what result it produces in some applications I've looked at, I'm not exactly sure how it works, in the sense of which url it chooses to load and how it knows to load a certain url over another. Can anyone explain?
$.ajax({
url: "json/Backboneapp_data.json",
dataType: 'json',
data: {},
async: false,
success: function (data)
{
_this._data = data;
_this._items = new ItemCollection(data);
_this._view = new MenuView({ model: _this._items });
_this._view.render();
Backbone.history.loadUrl();
}
});
Share
Improve this question
asked Oct 20, 2012 at 20:16
BrainLikeADullPencilBrainLikeADullPencil
11.7k24 gold badges81 silver badges138 bronze badges
1 Answer
Reset to default 9Notes on loadUrl
from the Annotated Source:
Attempt to load the current URL fragment. If a route succeeds with a match, returns true. If no defined routes matches the fragment, returns false.
So, if the current URL fragment (or the one you pass as a parameter) is valid, then it invokes route
. Note also that the function returns true if it resolved a valid route based on the fragment, otherwise false.
If it helps clarify: look down in the source, and you'll notice that loadUrl
is what navigate
calls if you specify the option trigger:true
.
本文标签: javascriptbackbonehistoryloadURLStack Overflow
版权声明:本文标题:javascript - backbone.history.loadURL - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741520832a2383172.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论