I am currently learning Angular 2 and encountering an issue with importing a custom module that contains interface declarations. Here is my folder structure:
https://i.stack.imgur.com/heIvn.png
The goal is to import product.interface.ts into a component located at
app/components/product/product.component.ts
. The import statement in the component file looks like this:
import { IProduct, IEmvoProduct } from '../../interfaces/product.interface'
I also attempted:
import { IProduct, IEmvoProduct } from '@app/interfaces/product.interface'
However, the module cannot be found.
The content of product.interface.ts
is as follows:
interface IProduct {
productCode: string;
description: string;
lawId: number;
name: string;
comment: string;
emvoProduct?: IEmvoProduct; // ?: Optional.
}
interface IEmvoProduct {
codingScheme: string;
name: string;
commonName: string;
pharmaForm: string;
strength: string;
packType: string;
packSize: number;
}
The objective is to have these interfaces in a standalone file that can be shared among other components.
How can I successfully import it?