Feature NgModules in NativeScript


#1

I want to start breaking out the features of my app into feature modules using NgModule. I have the following code that works by putting everything in the AppModule. But it does not work when I try to break it out. Am I missing something in my feature module?

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { ReactiveFormsModule } from "@angular/forms";

import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { NativeScriptHttpModule } from "nativescript-angular/http";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
import { NativeScriptRouterModule, RouterExtensions } from "nativescript-angular/router";

import { AppComponent } from "./app.component";
import { DateService } from '../../../common/services/date.service';

import { navigatableComponents, routes } from "./app.routing";
import { FeatureComponent, FeatureListComponent } from './feature/feature.module';

@NgModule({
    bootstrap: [AppComponent],
    imports: [
        NativeScriptModule,
        NativeScriptHttpModule,
        NativeScriptFormsModule,
        NativeScriptRouterModule,
        NativeScriptRouterModule.forRoot(routes),
        ReactiveFormsModule
    ],
    declarations: [
        ...navigatableComponents,
        AppComponent,
        FeatureComponent,
        FeatureListComponent 
    ],
    providers: [ DateService ],
    schemas: [NO_ERRORS_SCHEMA]
})
export class AppModule { }

However, when I try create a feature module and move the related components into that module, I get the following error (name obfuscated):

Here is the module I tried to create an its implementation:

Feature Module

import { NgModule } from '@angular/core';
import { DatePipe } from '@angular/common';

import { FeatureComponent }   from './components/feature.component';
import { FeatureListComponent }   from './components/feature-list.component';

@NgModule({
    imports: [ DatePipe ],
    exports: [ FeatureComponent, FeatureListComponent ],
    declarations: [FeatureComponent, FeatureListComponent],
    providers: [],
})
export class FeatureModule { }

Feature Components’ imports

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { FeatureModel } from '../../types/model';
import { DateService } from '../../../common/services/date.service'; // Provided in the App Module

// In the templates it uses: 
NgFor
DatePipe
StackLayout
Image 
Label
GridLayout 
ScrollView

App Module

import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
...
import { FeatureModule } from './feature/feature.module';

@NgModule({
    bootstrap: [AppComponent],
    imports: [
        NativeScriptModule,
        NativeScriptHttpModule,
        NativeScriptFormsModule,
        NativeScriptRouterModule,
        NativeScriptRouterModule.forRoot(routes),
        ReactiveFormsModule,
        FeatureModule
    ],
    declarations: [
        ...navigatableComponents,
        AppComponent 
    ],
    providers: [],
    schemas: [NO_ERRORS_SCHEMA]
})
export class AppModule { }