0
this.vendorService.getCities(e.id)
    .then((d) => {
            this.cityList = d.info;
        }

    });

when I check this.cityList in breakpoints it throw error but in console.log(this.cityList) it works fine .

I am using Angular-cli

Uncaught TypeError: Cannot read property 'cityList' of undefined

3
  • 3
    Show your code where you call this.vendorService.getCities Commented Sep 13, 2017 at 11:11
  • 2
    ^ This. You lost this in parent function scope. Commented Sep 13, 2017 at 11:13
  • see this answer stackoverflow.com/a/44739585/2545680 Commented Sep 13, 2017 at 12:19

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.