Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor .helpers function parameter

Is it possible to have pass a parameter from my template to a .helpers function parameter? I am trying the code below but I am always getting the error shown below. Thanks

Template.documentUpdate.helpers({

    getDocID: function(dCode){      
       return docsIDArray[dCode];
    }
});

in template:

<input type="hidden" id="docID" name="docID" value="{{getDocID(1) }}">

Error:

Exception from Tracker recompute function: Error: No such function: getDocID
like image 229
MChan Avatar asked Apr 02 '15 11:04

MChan


1 Answers

Your syntax is incorrect, try this :

<input type="hidden" id="docID" name="docID" value="{{getDocID 1}}">
like image 184
saimeunt Avatar answered Nov 15 '22 12:11

saimeunt