0
I have a simple page with 3 modals, which are opened by clicking buttons to request yes or no to perform actions. In one of them I only have this error, by clicking the yes button of the confirmation modal, which calls a function. Modals have the same html changing only text and function called (which are very similar too)
I already ran npm update and checked all modules and are up to date.
Code:
<ng-template #modal let-modal>
<div class="modal-header">
<h4 class="modal-title" id="modal3">Confirmação</h4>
<button type="button" class="close" aria-label="Close" (click)="modal.dismiss()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
Tem certeza que deseja executar essa ação?
</div>
</form>
</div>
<div class="modal-footer">
<div class="row">
<div class="col-lg-6">
<button class="btn btn-outline-dark" type="button" (click)="delete(3)">Sim</button>
</div>
<div class="col-lg-6">
<button class="btn btn-outline-dark" type="button" (click)="modal.dismiss()">Não</button>
</div>
</div>
</div>
</ng-template>
async delete(id:number) {
let response = await this.delete(id)
.toPromise()
.catch(error => this.error = error);
console.log(this.error);
}
delete(id:number) {
return this.myService.deleteById(id);
}
It does not get to call the function, impeding the error: - ERROR Typeerror: jit_nodeValue_5(...) is not a Function
- ERROR CONTEXTDebugContext_{view: {...}, nodeIndex: 13, nodeDef: {...}, elDef: {...}, elView:
I have tried to put the same function call outside the modal, on a button, and the error continues.
I appreciate contributions.
delete is a reserved word of javascript https://www.w3schools.com/js/js_reserved.asp
– Leandro Godoy Rosa
Thank you, really useful information.
– Sabrina