I have a class(IGeneric
) which is exported to the module A and I imported that Module(A) in module B, but I could not use that exported class(IGeneric
) in the module B.
Note : that exported class is not a component,directive and service.it is a plain typescript class
Any help will be appreciated, thanks in advance. The class which I am trying to export
export class IGeneric{
header : any[];
content : [{
lable :any,
value :any
}]
}
There is a trick to hide the details within a module by barrel files
, via which you can
index.ts
) to that module, andAs a follow-up, there is an another answer to elaborate what you can achieve by using barrel files.
This looks like an ES6/Typescript module import/export issue rather than an issue for (the completely different and separate) NgModule system.
If this is the case, then you simply need to import
the class you want from the file you want at the top of the .ts file, e.g.:
import { IGeneric } from './relative/path/to/definition';
and then use the class as you would normally in a component/service etc
public generic: IGeneric;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With