Closed RBleyenberg closed 2 years ago
Hi @RBleyenberg. So, this may be a naming issue. You call your entity Country
, but the class name is ICountry
and that may be causing problems. The modelName
must match the name of the class, so you should either set the modelName to ICountry
or rename the model to Country
.
The modelName
decorator property exists, so that at runtime, even with minified code, I know which class instance to reference when working with entities of a particular type. When the modelName
does not match the class name of your entity, auto-entity is unable to find and reference that class (which is decorated with metadata that is required for auto-entity to work its magic.)
ah that's it... so used to interfaces and naming them with I as prefix. overlooked that where using classes as model here and the model and modelName == entity
thx again \o/
Sure thing, @RBleyenberg! Let us know if you run into any other issues.
i'm getting the following error within the console;
[NGRX-AE] ! Entity key for 'Country' could not be found on this entity instance! Make sure your entity is properly decorated with the necessary key metadata. State will NOT be updated due to misconfiguration of your entity.
looking at my model.. i'm not seeing any errors as far as i know;
@Entity({ modelName: 'Country', pluralName: 'Countries', uriName: 'countries' }) export class ICountry { @Key id: string; code: string; name: string; }
any idea on where i need to look further to debug/resolve this error
thx again upfront