st_clair_clarke
st_clair_clarke

Reputation: 5715

Creating domain models in angular 6 for use in other libraries

I have many domain models that consist of an interface and its corresponding class, similar to the example below:

export interface ILanguage {
  first: string
  second?: string
}

export class Language {
  first: string = ''
  second?: string
}

In angular 5 it was easy just to import each model in the different parts of the programme. However, in angular 6 because of libraries this is not possible. I realise I would have to use libraries.

I would like some suggestions as to best practices or any suggestion as to how this could be accomplished.

Thanks

Upvotes: 1

Views: 1086

Answers (1)

Ronen
Ronen

Reputation: 837

I solved this by adding the interface/class explicitly in the public_api.ts

export * from './lib/<path to class file>

Upvotes: 1

Related Questions