-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handlebars cannot see the added view helpers #2
Comments
Hi, looks to be an issue with the latest versions of Handlebars: your example works for me with Handlebars 1.0.0-rc.3. Can you confirm me that you encounter this issue with a newer version (1.0.0.rc.4 or 1.0.0)? In the meantime, I'm gonna investigate. Thanks for reporting! |
Yep! Thanks for your response. #Snippet:
|
Loicfrering, thanks for any support :) Additional research here. Per you comment I punted back to 1.0.0-rc3. It 'partially' works. Result is: HellotestTemplate.html:54 GET http://localhost:8080/js/HelloView.js 404 (Not Found) require-with-comments.js:1872 Uncaught Error: Script error for: HelloView http://requirejs.org/docs/errors.html#scripterror require-with-comments.js:163So it seems to partially work - we get through the first render but die trying to get HelloView inserted in the subview render. Given that result I thought maybe something weird was happening with the AMD/require stuff, so I did a trimmed down version. Same code, but no AMD. Technically same result - cannot find HelloView. <script src="js/lib/jquery/jquery.min.js"></script> <script src="js/lib/lodash/lodash.min.js"></script> <script src="js/lib/backbone/backbone.js"></script> <script src="js/lib/view/handlebars-1.0.0-rc3.js"></script> <script src="js/lib/view/backbone.handlebars.js"></script>
RESULT: This example is still pretty much exactly what is in the docs so I'm not sure what's going on. Thanks, |
The HelloView must be accessible outside of your module pattern function in order to be resolved by Backbone.Handlebars, you can either:
FYI, here is the view resolution related code. |
The view sample presented isn't working for me.
here's my test:
var User = Backbone.Model.extend();
var HelloView = Backbone.HandlebarsView.extend({
template: 'Hello {{name}}'
})
var AppView = Backbone.HandlebarsView.extend({
template: '
Hello
{{view "HelloView" model=this}}'});
var app = new AppView({model: new User({name: 'Foli'})});
console.log(app.render().$el.html());
I am using the current version of the plugin, the latest backbone and jquery. I am using requirejs. Here's the entire code dump:
https://gist.github.com/revelfire/5881952
The text was updated successfully, but these errors were encountered: