How to export an abstract class using Angular 2 RC6 and NgModule

Angular 2 RC6 Problem !!!

So imagine a situation where we have a standard class such as ...

export abstract class FooBase {} 

and then we want to export this class, which will be used by other modules in the Angular 2 RC6 web application, the NgModule code may look like this:

 @NgModule({ declarations: [FooBase], exports: [FooBase], imports: [CommonModule], }) export class OurModule {} 

Unfortunately, when starting this inner chrome, it returns with ...

Unexpected value 'FooBase' exported from module 'OurModule'

This base class is used to extend an existing class inside another module, actually a simple one that I am doing wrong here.

+5
source share
1 answer

Do not use NgModule imports , exports , declarations to import and export class declarations. @NgModule is for components, directives, pipes, and services only.

Just use regular TypeScript import and export.

+9
source

All Articles