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
{{ message }}
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.
Maybe I am not doing something right as I just started with Typegoose. I created a TG class that extends Typegoose as normal. Now I want to be able to bring this class into my Angular 6 client-side to simply use as a regular class to hold data sent by the server. However, when I do Mongoose immediately throws a mountain of errors. Is there a way to get the raw, class I created for my TG entity so I can use it on the client side? Or am I possibly doing something wrong? Not sure if it is useful but here is some of the code:
`import { prop, Typegoose } from "typegoose";
export class Door extends Typegoose { @prop({index: true, unique: true, required: true})
id: number;
@prop({required: true})
open: boolean;
@prop({required: true})
locked: boolean;
//lock patterns are strings that when used on the matching key will open the lock
@prop()
lockPattern?: string;
//script to run when door is opened, not saved in db
openScript: any;
}`
And here is this same entity being created in an Angular front-end:
`import { Injectable } from '@angular/core';
import {Door} from "../../../../../../models/rooms/doorEntity";
@Injectable({
providedIn: 'root'
})
export class DoorService {
private door: Door = new Door();
}`
That is all that is required to cause the error. I am assuming that the Typegoose base automatically attempts to kick-off a Mongoose operation and of course, being on the client it isn't there and throws an error.
The text was updated successfully, but these errors were encountered:
Maybe I am not doing something right as I just started with Typegoose. I created a TG class that extends Typegoose as normal. Now I want to be able to bring this class into my Angular 6 client-side to simply use as a regular class to hold data sent by the server. However, when I do Mongoose immediately throws a mountain of errors. Is there a way to get the raw, class I created for my TG entity so I can use it on the client side? Or am I possibly doing something wrong? Not sure if it is useful but here is some of the code:
`import { prop, Typegoose } from "typegoose";
export class Door extends Typegoose {
@prop({index: true, unique: true, required: true})
id: number;
}`
And here is this same entity being created in an Angular front-end:
`import { Injectable } from '@angular/core';
import {Door} from "../../../../../../models/rooms/doorEntity";
@Injectable({
providedIn: 'root'
})
export class DoorService {
private door: Door = new Door();
}`
That is all that is required to cause the error. I am assuming that the Typegoose base automatically attempts to kick-off a Mongoose operation and of course, being on the client it isn't there and throws an error.
The text was updated successfully, but these errors were encountered: