Guest User

Untitled

a guest
Feb 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. address.ts:72 Uncaught (in promise) TypeError: Cannot set property 'stateShortName' of undefined
  2.  
  3. @bindable({ defaultBindingMode: bindingMode.twoWay }) address = new AddressDetails;
  4.  
  5. getStateData() {
  6. const headers = this.authService.header();
  7.  
  8. let stateDropdown = fetch("/api/selectData/GetStatesAndCompanyStateId", {
  9. method: "GET",
  10. headers
  11. })
  12. .then(response => response.json())
  13. .then(data => {
  14. for (const key in data.stateDropDownList) {
  15. this.states[key] = data.stateDropDownList[key].stateShortName;
  16. }
  17. console.log("ADDRESS get state data: ", this.address);
  18. console.log("data: ", data)
  19. this.companyStateShortName = data.companyStateShortName;
  20. console.log("StateShortName: ", this.companyStateShortName)
  21. })
  22. .then(() => {
  23. console.log("this.address.addressLocation: ", typeof this.address, this.address)
  24. this.address.addressLocation.stateShortName = this.companyStateShortName;
  25. //}
  26. });
  27.  
  28. ADDRESS get state data: AddressDetails {__observers__: { … } } address1: undefinedaddress2: undefinedaddressLocation: undefined__observers__: { address1: SetterObserver, address2: SetterObserver, addressLocation: SetterObserver } get address1: ƒ()set address1: ƒ()get address2: ƒ()set address2: ƒ()get addressLocation: ƒ()set addressLocation: ƒ()__proto__: Object
  29. address.ts:62 data: { companyStateShortName: "VIC", stateDropDownList: Array(8) } companyStateShortName: "VIC"stateDropDownList: (8) [{ … }, { … }, { … }, { … }, { … }, { … }, { … }, { … }]__proto__: Object
  30. address.ts:64 StateShortName: VIC
  31. address.ts:71 this.address.addressLocation: object AddressDetails {__observers__: { … } }
  32. address.ts:72 Uncaught (in promise) TypeError: Cannot set property 'stateShortName' of undefined
  33. at address.ts:72
  34. at<anonymous>
Add Comment
Please, Sign In to add comment