Search code examples
meteorcollectionfs

Meteor data context with collectionFS


I want to get the fave.title within the collectionFS each block where I have "TITLE HERE", any ideas?

<template name="myFaves">
    <div class="container">
    <div class="page-header">
            <h2>Your Favourites</h2>
        </div>
        <div class="row">
            <div class="col-md-12">
                {{#each faves}}
                    {{> singleFave }}
                {{/each}}
            </div>
        </div>
    </div>
</template>

<template name="singleFave">
    <div class="row">
        <div class="col-md-12">
            <div id="freewall" class="freewall">
            {{#each getMedia this.fileId}}
                {{#if isImage store='thumb'}}
                    <div class="brick">
                        <img src="{{this.url store='thumb'}}" width="100%">
                        <div class="info">
                            TITLE HERE
                        </div>
                    </div>
                {{/if}}
            {{/each}}
            </div>
        </div>
    </div>
</template>

Solution

  • I guess you need to access the parent context. Try it with {{../fave.title}} or {{fave.title ..}}.

    Note that grand-parent context could also be reached using {{../.. fave.title}}