javascript - How to go about to create general messages -


i new meteor , coming laravel enviroment got stuck on creating template general messages (error, success, info, warning etc).

this layout. can see, when event occurs , goes wrong (or succeed) want show message.

<template name="layout"> <div class="ui grid">     {{>header}} </div> <div class="ui stackable page grid">     {{#if somestatement}}     {{>messages}}     {{/if}}     {{>yield}} </div> </template> 

for example login event:

template.login.events({     'submit #login-form' : function(e, template) {         e.preventdefault();          var email = template.find('#login-email').value,             password = template.find('#password').value;          meteor.loginwithpassword(email, password, function(err){             if(err)             {                 /*here want return error , type template */              }             else             {                 route.go('dashboard');             }             return;         });         return false;     } }); 

the message template:

<template name="messages">     <div class="ui {{type}} message">         <i class="close icon"></i>         <div class="header">{{headermessage}}</div>         {{message}}     </div> </template> 

but have no clue on how go it. tried tons of stuff , seems super easy thing do, im not read enough it. appreciated.

check out flash-messages package. it's designed used bootstrap , provides ability show various types of messages. there lots of examples in readme on atmosphere.

https://atmospherejs.com/mrt/flash-messages


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

c# - Retrieve google contact -

javascript - How to insert selected radio button value into table cell -