-1
export class SonComponent extends ParentComponent {

 public say() {
     console.info('hello!my parent is ' + super.getName());
 }
}
export class ParentComponent {
  public getName() {
    return this.getFirstName() + this.getLastName(); // <--- exception, core.js:4002 ERROR TypeError: this.getFirstName is not a function
  }
  public getFirstName() {
    return 'wu';
  }
  public getLastName() {
    return 'victor';
  }

exception, core.js:4002 ERROR TypeError: this.getFirstName is not a function

why?

HelloWorld
  • 147
  • 1
  • 1
  • 14

2 Answers2

0

where are the constructors in your components...??? as you are extending ParentComponent

childs constructor should call ParentComponent, find the code for ref

export class SonComponent extends ParentComponent {
 constructor(){
  super();
  }    
 public say() {
     console.info('hello!my parent is ' + super.getName());
 }
}

hope this resolves your issue... and in ts/js weather you mention return type or not doesn't matter unless you are strictly expect a particular type of response

pavan kumar
  • 823
  • 6
  • 15
  • this's dome code, pseudo code. It's settled. Thank you – HelloWorld Nov 20 '19 at 05:29
  • what was the resolution? if it was because of my answer you can upvote or else post the correct answer... that would help others finding a solution for the same problem – pavan kumar Nov 20 '19 at 05:42
0
public beforeUploadImageResult = (file: File) => { √
}


public beforeUploadImageResult(file: File): any { ×
}


https://ng.ant.design/components/upload/en

[nzBeforeUpload]

Hook function which will be executed before uploading. Uploading will be stopped with false or a Observable. Warning:this function is not supported in IE9. NOTICE: Muse be use => to define the method.

HelloWorld
  • 147
  • 1
  • 1
  • 14