Hey guys, I want to create an app that will show controls if user is authorize and hide controls, on the start, and I’m using node.js to answer if the user is authorized or not. That’s my code:
// _app/controllers/index.js_
showControls:false,
check: function ()
{
Ember.$.ajax
({
type:"GET",
url:"http://localhost:3000/check/",
dataType: 'text',
success:function(data)
{
if(data==="true")
{
this.toggleProperty('showControls');
}
}
});
}.on('init'),
and that’s from Back-End:
router.get('/check', function(req, res)
{
return res.json(true);
});
I think that the toggleProperty inside the Ember.jQuery Ajax GET is not working, what should I do in that case?
Greetings, Rafał