mardi 26 juillet 2016

Ember : toggleProperty is not working inside a jQuery Ajax GET

I'm making an app that if the person is authorized the control panel will show up, and It's almost done but i have a problem with changing the property.
Function this.toggleProperty is working great, but not in an Ember jQuery Ajax Function.
What can I do in that case?

showControls:false,
         someName: function () 
    { 
          {
          Ember.$.ajax
               ({
                   type:"GET",
                   url:"http://localhost:3000/check/",
                   dataType: 'text',
                   success:function(data)
                   {
                     if(data==="true")
                     {
                        this.toggleProperty('showControls');
                     }
                   }
               });
           }
     }.on('init'),

And this is my example back-end in node:

    router.get('/check', function(req, res) 
{
        return res.json(true);
});

And this is my problem:

Uncaught TypeError: this.toggleProperty is not a function

Greetings, Rafał




Aucun commentaire:

Enregistrer un commentaire