5

I am building an app with Ionic 3, Angular 4 and Firebase and I am very much confused about data modeling. There are two ways.

  1. Create a model class, declare variables and methods.
  2. Create an Interface

I am not sure which approach should I take when. An interface will be empty body but will allow optional variable but class will not.
I am just looking for a clear idea of data modeling.

Tapas Mukherjee
  • 2,088
  • 1
  • 27
  • 66
  • This is going to be subjective, and not really an answer: but I prefer to create regular JS classes to for my data types, and then have angular services manage the data. Interfaces are a TypeScript thing, if that matters to you. – hayhorse Oct 10 '17 at 00:57
  • 1
    Possible duplicate of [When to use Interface and Model in TypeScript / Angular2](https://stackoverflow.com/questions/37652801/when-to-use-interface-and-model-in-typescript-angular2) – Antikhippe Nov 11 '17 at 17:04

0 Answers0