0
I have the following classes in an Ionic 2 app
export class JobIteractionsModel {
public _idJob: number;
get idJob() { return this._idJob }
set idJob(idJob: number) { this._idJob = idJob }
public _dataHoraInicio: Date;
get dataHoraInicio() { return this._dataHoraInicio }
set dataHoraInicio(dataHoraInicio: Date) { this._dataHoraInicio = dataHoraInicio }
public _dataHoraFim: Date;
get dataHoraFim() { return this._dataHoraFim }
set dataHoraFim(dataHoraFim: Date) { this._dataHoraFim = dataHoraFim }
public _valorTotal: number;
get valorTotal() { return this._valorTotal }
set valorTotal(valorTotal: number) { this._valorTotal = valorTotal }
}
import { JobIteractionsModel } from './JobIteractionsModel';
export class JobModel {
public _id: number;
get id() { return this._id }
set id(id: number) { this._id = id }
public _cliente: string;
get cliente() { return this._cliente }
set cliente(cliente: string) { this._cliente = cliente }
public _telefone: string;
get telefone() { return this._telefone }
set telefone(telefone: string) { this._telefone = telefone }
public _email: string;
get email() { return this._email }
set email(email: string) { this._email = email }
public _descricao: string;
get descricao() { return this._descricao }
set descricao(descricao: string) { this._descricao = descricao }
public _interacoes: JobIteractionsModel[];
get interacoes() { return this.interacoes }
set interacoes(interacoes: JobIteractionsModel[]) { this._interacoes = interacoes }
public _adicionaInteracao(interacao: JobIteractionsModel) {
this.interacoes.push(interacao);
}
public _deletaInteracao(index) {
this.interacoes.splice(index, 1);
}
public _subtotal: number;
get subtotal() { return this.subtotal }
set subtotal(subtotal: number) { this._subtotal = subtotal }
public _desconto: number;
get desconto() { return this.desconto }
set desconto(desconto: number) { this._desconto = desconto }
public _total: number;
get total() { return this.total }
set total(total: number) { this._total = total }
}
When I create a new instance of the class Jobmodel and check on the Chrome element inspecter, the property interactions, "Maximum call stack size exceeded" error is being displayed.
Same error appears when trying to use method _additionInteration of a class instance Jobmodel.
I don’t understand why yet, but when I invoke the method, _additionInteration()
And then the execution goes to this line, and it runs recursively until the error.
Any help will be most welcome.
Chrome console shows no error?
– mercador
Shows what is released on the console
– Giovane
Maybe relevant: https://github.com/Microsoft/TypeScript/issues/12735
– OnoSendai
I edited the question including a console print.
– Silvair L. Soares
@merchant, Giovane included the console print and new prints to better detail the problem. Thank you.
– Silvair L. Soares