Comments (14)
👍 Trying to create a form with dynamic inputs components. What is the reason Template.dynamic
does not work? I can't even get normal templates to render inside a component.
from meteor-blaze-components.
Normal components should work inside a component. So if you want to include a normal component that should work well. But it is true that I do not have a test case for that. Feel free to make one. :-)
The other way, it does not work because components are not templates. They just use templates for content. So when you do Template.dynamic
you are in fact including just the raw template content, not the component.
from meteor-blaze-components.
Odd, it was not working for me. May be a bug related to #30 I will review.
from meteor-blaze-components.
@Kestanous please post your findings. Did you get anywhere with using FlowLayout as a component? (#19)
from meteor-blaze-components.
@offthegrass I am actually fighting off a head cold so I am only responding to issue today. I will try to investigate more on all points tomorrow, assuming I can thing again.
from meteor-blaze-components.
Now you can simply use Template.dynamic
and pass component's name as a template
argument. And it will use the component.
But a disclaimer. Often it is better that instead of using Template.dynamic
to create a method on the current component which is returning such a dynamic value. So that you move this logic into the component. Then somebody else can later on extend/override it in subclasses.
So instead of doing:
You could do:
class FooComponent extends BlazeComponent
renderFoo: ->
BlazeComponent.getComponent(@data().foo).renderComponent @currentComponent()
from meteor-blaze-components.
Wait a minute, I tried passing the register
'd name of the component to Template.dynamic. It rendered, but it has no access to the component's methods at all.
from meteor-blaze-components.
I have this in tests. And tests work. So I am not sure what is happening here? Can you get a reproduction going on? Or adding/modifying tests so that they fail in the same way you are observing?
from meteor-blaze-components.
Sorry about that, Meteor's shell was messing with me.
from meteor-blaze-components.
How do I pass args to the renderComponent call? i.e.
from meteor-blaze-components.
You cannot, this is a limitation I do not know how to go around: #12.
from meteor-blaze-components.
@mitar, when you do this:
class FooComponent extends BlazeComponent
renderFoo: ->
BlazeComponent.getComponent(@data().foo).renderComponent @currentComponent()
Does that render the component while inheriting the instance properties of the @currentComponent()
?
from meteor-blaze-components.
No, it sets current component as parent component. So you can access it and its properties through @componentParent()
. You can also do that in the handlebars {{componentParent.bla}}
.
from meteor-blaze-components.
Gotcha thanks.
from meteor-blaze-components.
Related Issues (20)
- Example of mixin for two-way binding HOT 3
- TemplateTwoWayBinding HOT 3
- Template2
- How do you guys do Modals? HOT 8
- [Question] Best way to create a documentation about components HOT 23
- Ideas for new features of Blaze Components HOT 9
- [Question] Migrating to Blaze once the npm version is released. HOT 1
- Write template HTML within component JS? HOT 2
- How to unit-test a component? Guidance needed HOT 5
- Values is not defined HOT 2
- General Question HOT 1
- Interfacing with react.js HOT 6
- In-line component creation for lack of method params HOT 3
- What projects besides weekan are built with this library HOT 3
- Performance HOT 1
- Template Strings ? HOT 1
- Support coffeescript 2 (in Meteor 1.6.1) HOT 8
- Migrating to react: Rendering of BlazeComponents via React is NOT possible HOT 2
- error updating to Blaze Components 0.23 & Meteor 1.8.2-rc.3 HOT 3
- Meteor 1.8.2: ReferenceError: meteorBabelHelpers is not defined HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-blaze-components.