merkle-open / generator-nitro

Your frontend? Fuel it with Nitro! Develop your frontend with a proven but flexible Node.js app, even in a large team.
MIT License
71 stars 28 forks source link

Data interface for components helper #13

Closed beatgeb closed 9 years ago

beatgeb commented 9 years ago

Would it make sense to allow passing data to a component via the component helper. For exmple to share data used in multiple components (like user information or labels).

I could imagine that this happens by referencing one or more data resources or the ugly way by providing serialized JSON strings (not really reusable it not done by an additional helper).

This question might be important for integrations in Spring to simulate the model provided to the view.

deniaz commented 9 years ago

Hi Beat,

isn't that part of the following PR/commits?

10

9ba568dd93 70d0699f81

beatgeb commented 9 years ago

You are right. It points in the right direction. But in my opinion it does not work at the moment because of the usage of data.root instead of data itself

componentData = lastArgument && lastArgument.data ? lastArgument.data.root : {};
ernscht commented 9 years ago

Hope #17 would cover your needs. We will try do add some other possibilites to add data to view & components. For now, you can add some global data for views & components in your routes (e.g. https://github.com/namics/generator-nitro/blob/develop/app/templates/app/core/router.js#L87 )

beatgeb commented 9 years ago

Thanks. That helps.