mardi 8 mai 2018

Needs to call console outside the function

I had wrote the console log in the below function, The presentDialog() function is on given below

presentDialog: function () {
        return new Promise(function (resolve, reject) {
           RSuite.services({
               service:'content/inspect',
               json: true
           })
           .done(function (result) {    
                    resolve(result);
           }.bind(this));
        });
    }.on('init'),

Expected output needs to be like:

    var result1;
    this.presentDialog().then(function(result2) {

                  result1 = result2 
              });
 console.log(result1)

I'm new to the ember and javascript. The console log is calling inside the function, but I need to print outside the function. Please provide me suggestion on this. Your help will be appreciate. Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire