ms-seo icon indicating copy to clipboard operation
ms-seo copied to clipboard

Scoping Issue?

Open NewETown opened this issue 9 years ago • 3 comments

I'm seeing a weird issue in Meteor 1.0.3 where SEO.set({ ... }); isn't able to see my local post variable. Code below:

onAfterAction: function() {

        if (!Meteor.isClient) {
            return;
        }

        var post = this.data();
        SEO.set({
            'title': post.title,
            'meta': {
                'description': post.short
            },
            'og': {
                'title': post.title,
                'description': post.short,
                'image': post.image_url
            }
        });
    }

Exception in callback of async function: TypeError: Cannot read property 'title' of undefined (this is throwing at the first call of post.title)

The data exists, if I do console.log(post) I can see everything I'm looking for. Any suggestions?

NewETown avatar Mar 19 '15 13:03 NewETown