Quantcast
Channel: Why angular model interfaces are exported? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Why angular model interfaces are exported?

$
0
0

In angular - the models (model interfaces) are declared like so:

export interface PersonInterface {  id: number;  name: string;}

and then in some other component,service etc. your import this interface and use it like so:

...import { PersonInterface } from './blabla';...export class SomeService {  person: PersonInterface;}

So my question is - what is the purpose of using export in the declaration of the interface?

interface PersonInterface {  id: number;  name: string;}

If I don't use export - I can still use it in the service and I even do not need to import it:

export class SomeService {  person: PersonInterface;}

Everything works fine, no errors and from the IDE I can go to the declaration if the interface (Ctrl+Click over the interface name). Am I missing something?

Cheers


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images