Comments (5)
Why do you need access to the template instance, if you can share? I hope that there is no need to access it directly.
I moved @templateInstance
to @_componentInternals.templateInstance
with 6fee849. To minimize the number of fields components use on the instance to only one, @_componentInternals
.
I am sorry that this broke things for you. But that should really be something internal you would not have to access during normal use. So I would like to learn more about your use case. Feel free to access it through @_componentInternals
. I will not be moving it away anytime soon anymore.
Also, this should be just a cosmetic change, so everything should be rendering as it was.
from meteor-blaze-components.
Please confirm that it works once you start using @_componentInternals
instead of @templateInstance
.
from meteor-blaze-components.
Hi, I actually came across this problem myself. Here is what I'm trying to accomplish:
I'm building a set of components, which I can re-use to quickly build "table views" - that is a table with data, pagination component, page-size component, filter field component, etc.
The target use case is something like this:
<template name="MyTableView">
{{> Pagination}}
<table>
<th>
<tr>Name</tr>
<tr>Address</tr>
</th>
{{#each data}}
<tr>
<td>{{name}}</td>
<td>{{address}}</td>
</tr>
{{/each}}
</table>
{{> PageSize}}
</template>
Where MyTableView is a component with a Mixin, which handles template level subscription and holds the current state (page index, page size, etc.)
Because I'd like to avoid having to pass "bridge variables" to the Pagination and PageSize components, like this:
{{> PageSize pageIndex=pageIndex pageSize=pageSize totalCount=totalCount}}
I want to have the PageSize component access parent template instance variables and read/write to the pageIndex (and other) "table view state variables".
I know that I can now use the @_componentInternals.templateInstance
, but maybe there is a better way of "connecting" the components (avoiding global state).
Thank you
from meteor-blaze-components.
I want to have the PageSize component access parent template instance variables and read/write to the pageIndex (and other) "table view state variables".
Do you mean something like @componentParent()
to get the parent component instance? Then you can access the data context, variables and methods on that component instance.
from meteor-blaze-components.
Thank you Jernej - that's exactly what I needed. I missed it in the documentation.
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.