Skip to content

Instantly share code, notes, and snippets.

@davidworkman9
Created February 18, 2014 20:38
Show Gist options
  • Save davidworkman9/9079568 to your computer and use it in GitHub Desktop.
Save davidworkman9/9079568 to your computer and use it in GitHub Desktop.
var errors = new Meteor.Collection(null);
Template.my_templ.errors = function () { errors.find().fetch(); };
Template.my_templ.events({
'submit': function () {
if ($('#firstName').val() === '') {
errors.push({ msg: 'First Name Required' });
}
}
});
<template name="my_templ">
{{#each errors}}
<div class="alert alert-danger">
<button type="button" class="close" data-dismiss="alert">&times;</button>
{{msg}}
</div>
{{/each}}
<input id="firstName" />
</template>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment