Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Rendering child views fails #135

Open
Zensavona opened this issue Apr 16, 2014 · 3 comments
Open

Rendering child views fails #135

Zensavona opened this issue Apr 16, 2014 · 3 comments

Comments

@Zensavona
Copy link

I have not found a way of passing a view to a template and rendering it using the {{view childViewName}} helper. In fact I'm quite sure that somehow helpers are broken for me (?) as I get the same error whenever I try to use other kinds of helpers (e.g. {{collection someCollection}})

The error:
Uncaught TypeError: Cannot read property '_helperName' of undefined
StackOverflow to reproduce

@ChadMartinson
Copy link
Contributor

Just curious. Why aren't you using the template thorax provides? Like this...
In your router...
index: function () {
var view = new ParentView({
child: new BunnyRabbitsListView(),
});
RootView.getInstance().setView(view);
}

Then in your BunnyRabbitsListView template you can place

Hello World

.

in the index template {{view child}} will render.

@ChadMartinson
Copy link
Contributor

Same for child collections. On your route you can do something like this...

index: function () {
var bunnies = new BunnyRabbitsListView(),
var view = new ParentView({
child: new BunnyRabbitsListView({
bunnylist: bunnies
});
});
RootView.getInstance().setView(view);
}

Then in your BunnyRabbitsListView template...

{{#collection bunnylist}}
{{your bunny model attrs}}
{{/collection}}

@qbunt
Copy link
Contributor

qbunt commented Jul 13, 2015

With the version that is referenced in this generator, this bug has not been fixed like it has been in the Thorax library. Please see #149 for some more info. You can do this in Thorax proper (especially in IE11) but the fix has not been pulled downstream to this project @ChadMartinson

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants