-
Notifications
You must be signed in to change notification settings - Fork 37
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
Template Data Context to use with metadata OR How to use it with Template...events() ? #160
Comments
You can probably define the |
So, for example here: https://github.com/vsivsi/meteor-file-sample-app/blob/master/sample.coffee#L26 |
Hi @vsivsi ! Thanks for the prompt support! I have done like you suggested. I have put both The problem is that the metadata is not updated! It picks up the data of the first time it rendered only. For example, if I first render for CityId= "nyc" and later go to page with CityId="Boston", the metadata will not be updated. It will still show CityId= "nyc". Meteor simply don't pass again though function I also tried having |
I laso tried using In fact it works nicely and re-runs part of the code. However, nothing inside This is what I did:
|
I didn't realize that the metadata could change after rendering... in that case you are gong to need to find a way to make your up-to-date metadata available to the resumable handler functions. I think you are on the right track with the code above. Declaring a variable to hold a metadata object visible to the scope where the resumable handlers are declared. Then keep it updated using template autorun or helper functions. You don't want to redeclare the fileAdded handler in the autorun though. You should declare the shared variable in the onRendered, keep it updated in the autorun, and use it in the fileAdded handler. Sorting out variable scoping like this is a JavaScript / Meteor client / resumable.js programming question that has nothing really to do with file-collection itself. (Resumable.js is an independent project). I'm happy to help, but answering basic programming questions like this in a github issue without understanding the whole scope of your app and its requirements is going to be of limited usefulness. |
Thanks @vsivsi, taking the So far could only pass the shared variable to the resumable.on callback function as global as they are not visible outside |
My app is working fine for upload using the code from examples.
However, the examples are placing the code on Meteor.startup(). I need to get information from the template Data context in order to fill in the metadata fields. In Meteor.startup() I don't get the information.
For instance, iron-router renders me a template with CityId="nyc". I want to upload photo with metada CityId="nyc". It seems like I can only setup metadata once at startup or onRendered.
See the code I am trying to use:
This
myfile.resumable.om('filAdded'
, ... confuses me I guess. Is there a way to use it with standard Template...events() ?The text was updated successfully, but these errors were encountered: