javascript - Return url from global template helper using CollectionFS -
im trying url of uploaded image using global template helper. far tried doing isprimary.url() null, otherwise isprimary.url returns function. idea how deal this?
user_item.html
<template name="useritem"> <div class="col-md-3"> <div class="text-center"> <img width="80" class="img-rounded" src="{{primarypicture store='thumb'}}"> </div> </div> </template>
global_templates.js
template.registerhelper('primarypicture', function () { var isprimary = images.findone({userid: this._id, primary: true}); if (isprimary) { return isprimary.url(); } else { return '/user.png'; } });
i dont know why isprimary.url(); returns null when should return original url, fix doing isprimary.url({store:'thumb'});
Comments
Post a Comment