Hey guys,
I’m very new on Meteor and having my first beginnerst question. I’m using ‘MaterializeCSS’ in my project. They hava own select fields which I have to initialize with “$(‘select’).material_select();”. I’m using it in my start.js:
Template.start.onRendered(function () {
$('select').material_select();
});
In my start.html, I have the current markup:
<select id="gender">
<option value="" selected disabled>Choose your gender</option>
<option value="1" {{selectedIf curUser.profile.gender 1}}>male
</option>
<option value="2" {{selectedIf curUser.profile.gender 2}}>female
</option>
</select>
selectedIf is a helper which return ‘selected’, curUser is a helper which returns “Meteor.user()”. Now, I’ve the following problem: The fields doesn’t get automatically selected, because when “onRendered” fires, the values for “curUser” aren’t available. This means that I’ve to set the values manually by jQuery, when curUser is available
My question is: How can I execute “$.select()” when Meteor.user() is available for this template?