You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now in analysis I found issue in below lines
json-api.model.js -> JsonApiModel.prototype.parseHasMany ->
var modelType = Reflect.getMetadata('JsonApiDatastoreConfig', this.internalDatastore.constructor).models[typeName];
here typeName is child-activity which coming as undefined because in models array it is activities and its looking for child-activity.
The key activities referring from JsonApiDatastore models array and typeName 'child-activity' getting value from ChildActivity class type metadata.
I hope you understand the Issue and root cause.
Please share if you have any work-around or how can I override this function if possible.
Thanks
The text was updated successfully, but these errors were encountered:
Hi Team,
I am getting below error
parseHasMany - Model type for relationship activities not found
Please go through below codes
ParentActivity.ts
import { JsonApiModel, JsonApiModelConfig, Attribute, HasMany } from "angular2-jsonapi";
import { ChildActivity } from "./childactivity.model";
@JsonApiModelConfig({
type: 'parent-activity'
})
export class ParentActivity extends JsonApiModel {
@Attribute()
id:string;
@Attribute()
name:string;
@hasmany()
activities: ChildActivity[];
}
ChildActivity.ts
import { JsonApiModel, JsonApiModelConfig, Attribute, BelongsTo } from "angular2-jsonapi";
@JsonApiModelConfig({
type: 'child-activity'
})
export class ChildActivity extends JsonApiModel {
}
@Injectable()
@JsonApiDatastoreConfig()
export class ActivityDataStore extends JsonApiDatastore {
constructor(http: HttpClient, @Inject('API_URL') public linkToAPI: string) {
super(http);
this.config = {
baseUrl: this.linkToAPI,
models: {
activities: ChildActivity,
activityGroup: ParentActivity
}
}
}
}
Now in analysis I found issue in below lines
json-api.model.js -> JsonApiModel.prototype.parseHasMany ->
var modelType = Reflect.getMetadata('JsonApiDatastoreConfig', this.internalDatastore.constructor).models[typeName];
here typeName is child-activity which coming as undefined because in models array it is activities and its looking for child-activity.
The key activities referring from JsonApiDatastore models array and typeName 'child-activity' getting value from ChildActivity class type metadata.
I hope you understand the Issue and root cause.
Please share if you have any work-around or how can I override this function if possible.
Thanks
The text was updated successfully, but these errors were encountered: