meteor - Button State Persistence -
i have 'create post' button in user can use submit post. want user able create 1 post @ time. user have remove first post create another, or have wait post removed else - acceptable.
also, want button disabled
when there live post of theirs.
so, basically, what's best way attach state of button state of post, post removed, button enabled.
thanks.
fortunately, spacebars makes easy do. have @ "smarter attributes" section of this post.
here example:
<template name="post"> <button disabled={{isdisabled}}>create post</button> </template>
template.post.isdisabled = function () { return posts.findone(); };
in case button disabled if posts found, can modify specific requirements.
Comments
Post a Comment