-
-
Notifications
You must be signed in to change notification settings - Fork 969
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
nested object rendering #81
Comments
This is a decent request. Probably need to implement it. Thanks! |
of-course it might somewhat risk the renderer current performance though ;) |
Yeah. However this doesn't sound too heavy and is useful. I've had the same need as well. |
great. looking forward then... (I'm afraid to touch that black magic regex function myself :)) |
Seems @potomak did the job already! Support for nested objects is now there. Enjoy! |
Hi. Tried to use the fix but doesn't seem to work?! :( I get literally the "{obj.property}" string rather than the value. |
@potomak can you check the above? Thank you! |
@tipiirai @tpaz I don't see any error, see http://jsbin.com/dezazate/1/edit |
@potomak yes I saw the assertion test. yet in my environment it failed. Sample works indeed. It was a problem in my environment. works charms now :) |
This is very useful. In my usage I also found this limitation to be too big a nuisance. Thanks for fixing. |
Yeah. Seems to perform well and doesn't add any logic on the template layer. |
Hi @potomak - is it possible to use key['property'], e.g. person['firstName'] as per your example, too? I'm guessing not, just posting here to make sure I'm not using it wrong :) |
@mgustafsson1 no you can't, you can use only |
@potomak That was quick, thank you! Will use dot notation only for now. |
Hi.
I found it as tough constraint that I can't pass nested objects into the riot template renderer.
Consider a simple two levels of nested object such as the following model object ("data" is just for initialization from store for example):
function Items(data) {
this.name = data.name;
this.price = data.price;
this.details = { 'id': data.details.id, 'image': data.details.image }
...
}
When tested with a template, only the flat properties (such as name and price) would work for me, but the nested ones like so: details.id - would not.
when I looked at the renderer function (regex) I realized it won't work since it does not expect a dot nor a key['name'] format.
Thoughts?
Must I use only Flat properties in model? in other frameworks of-course it is possible.
I don't think it would break the constraint mentioned in Riot blog about the architecture of flat templates to have nested variables. it is not adding any logic
TIA
Tomer
The text was updated successfully, but these errors were encountered: