ember.js - how make if statement emberjs with a true or false in a json file -



ember.js - how make if statement emberjs with a true or false in a json file -

i want create if statement in ember template checks if user logged_in or not

the server returns following:

{"status":"ok","logged_in":false} or {"status":"ok","logged_in":true}

if user logged in show form else show content

how check what's "logged_in" status with? can utilize in ember template:

{{#if logged_in}} show form {{else}} show content {{/if}}

that's how it! problem have how appropriately set context. simplicity, let's homecoming model hook, set context of related template. in case below, i've associated index route, , nail index route/template when nail root of our app.

app.indexroute = ember.route.extend({ model: function() { homecoming {"status":"ok","logged_in":false}; } });

http://emberjs.jsbin.com/zohabeti/1/edit

json ember.js

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -