I have a registration / registration module, and I want to write a model for them.
I would use interfaces, but I need to have one predefined value.
And I was wondering - should I predetermine a constant (it will not change, change) and use interfaces. Or write it as classes (as of now)
Currently, I have written two separate classes - registration.model.ts, login.model.ts, can I abstract to use only one model? (example: user.model.ts)
Some examples:
export class LoginUser { constructor( private email, private password, // I need to have it, backend expects it to be sent private connection = 'Username-Password-Authentication' ) { } } export class RegistrateUser { constructor( public name: string, public lastName: string, public email: string, public password: string, // I need to have it, backend expects it to be sent private connection = 'Username-Password-Authentication' ) { } }
angular typescript
Tomas Eglinskas
source share