Operating Environment: Windows 10, IntelliJ 2016.2, node
Angular Version: 2.0.0-rc.6
Language: [all | TypeScript X.X | ES6/7 | ES5] Typescript ES6
Node (for Ahead of Time Compilation issues):
node --version
=
Node 4.4.7, NPM 3.10.6
The AOT compiler is failing and giving an error related to a function call or lambda reference. The specific reference causing the issue is RouterModule.forChild(ROUTES). Interestingly, this previously worked without any problems. It seems essential for the app to function correctly.
// /**
// * Angular 2 decorators and services
// */
// // import { BrowserModule } from '@angular/platform-browser'
//
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
//
import { ROUTES } from './detail.routes';
/*
* Shared Utilities & Other Services
*/
import { Logging } from '../services/utility.service';
/**
* Imported Components
*/
import { DetailComponent } from './detail.component';
@NgModule({
declarations: [// Components / Directives/ Pipes
DetailComponent],
imports: [CommonModule, BrowserModule, FormsModule, RouterModule.forChild(ROUTES),]
})
export class DetailModule {
constructor() {
if (Logging.isEnabled.light) { console.log('%c Hello \"Detail\" component!', Logging.normal.lime); }
}
}
The error message states:
Error: Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, when trying to resolve symbol DetailModule in C:/Source/POC/Microservice.Poc/src/app-components/+detail/index.ts
at simplifyInContext (C:\Source\POC\Microservice.Poc\node_modules\@angular\compiler-cli\src\static_reflector.js:473:23)
...
Compilation failed
I'm puzzled as to why RouterModule.forChild(ROUTES)
is causing compilation errors with AOT, when it works perfectly fine in another repository available at this link.