0

I added an Image with the error I am not able to see the this variable in the then method of the firebase.Promise. I also can not see _this.

this._messaging.getToken().then( (currentToken) => {
  if (currentToken) {
    console.log('Ok!!!!!');
  //  _notificationToken = currentToken;
  } else {
    console.log('No Instance ID token available. Request permission to generate one.');
  }
})
  .catch(function (err) {
    console.log('An error occurred while retrieving token. ', err);
  });
  • Your question is a bit vague. Can you give more detail? What's expected to happen? What is actually happening? – eko May 13 '17 at 09:39
  • I managed to solve it by having a "const that = this; " before the call. Now I have the problem that in the onMessage function I can not access the "this" variable. I created a git repository to simulate the problem , can you please take a look https://gitlab.com/bratualex/angular-firebase – Bratu Alexandru May 13 '17 at 10:41
  • Add in the added information to the Question itself, not as a comment. So that other can better view your question and answer it. – Smit May 13 '17 at 11:31
  • Where is your `onMessage` function? – Smit May 13 '17 at 11:32
  • I added an Image with the error after I the change you proposed. there is something in the this variable but not what I expect. – Bratu Alexandru May 13 '17 at 12:45

0 Answers0