I am really new working with Angular 4 and Chrome Extensions, but I have this code to comunicate my app in Angular with the Chrome extension.
Code in Angular 4.
public myObjectExtension : any;
public getObjectChrome(){
    chrome.runtime.sendMessage(extensionID, 'getObject', function(response) {
        console.log(response);
        this.myObjectExtension = reponse;
  });
}
and I have this in my Chrome Extension.
chrome.runtime.onMessageExternal.addListener(
   function(request, sender, sendResponse) {
     if(request == "getObject"){
          sendResponse({
              name: "Afro",
              lastname: "Chase"
          });
     }
When I run the application the console log show me correctly the data, like this.
{name: "Afro", lastname: "Chase}
but when I pass the value of "reponse" to "this.myObjectExtension", the console shows me this
TypeError: Cannot set property 'myObjectExtension' of undefined
I undestand that var "this.myObjectExtension" is not defined inside of the method, but how can I do to retrive the "response" and assign it to my var "this.myObjectExtension"?
