Hi,
So I am trying to POST an object from my aurelia component class. As soon as I added another prop to the object I get this weird error.
ReferenceError: abbreviation is not defined
public newType: VulnType = { id: null, name: null , abbreviation: null};
create(): void {
console.log('create called ', this.newType)
this.api.createVulnType(this.newType)
.then((res) => {
if (res.id) {
this.vulnTypes.push(res);
this.apiMsg.valid = true;
this.apiMsg.text = `${res.name} added to api`;
this.reset();
}
}).catch(err => {
console.log('err == ', err)
this.apiError['message'] = `${err}`;
this.reset();
});
}
Basically the api method is never called. Instead, it is caught here and the error message is displayed:
this.apiError['message'] = `${err}`;
I bind to the types in the template like so value.bind="newType.name
and value.bind="newType.abbreviation
Any ideas?