Answer the question
In order to leave comments, you need to log in
How to call a method of one class in another?
Hello! available Model:
class Model extends EventEmitter {
constructor() {
}
getMethod() {
console.log()
}
}
export default class View extends EventEmitter {
_model: Model;
_elements: Elements;
constructor(model: any, elements: any) {
super();
this._model = model;
this._elements = elements;
}
test() {
console.log(this._model.getMethod());
}
}
Answer the question
In order to leave comments, you need to log in
If this._model is true an object from Model, then there will be no problems. Your error says something else. It does not mention getMethod, but getItems. Look for the problem elsewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question