So I've upgrade from RC1 to the final release of Angular2. I've done a lot of adjustments but every time I injected RuntimeCompiler
on my AppComponent
, this error occurs.
I have no idea what is happening here and haven't seen the answers for the web regarding this issue. Any help would be appreciated, anyway here is my AppComponent for reference.
import { Component } from '@angular/core';
import { Location } from '@angular/common';
import { Router } from '@angular/router';
import { RuntimeCompiler } from '@angular/compiler';
@Component({
selector: 'content',
template: '<router-outlet></router-outlet>'
})
export class AppComponent {
constructor(
private location: Location,
private router: Router,
private runtimeCompiler: RuntimeCompiler
) {;
if (localStorage.getItem('id_token') == undefined) {
if (location.path().toLowerCase().startsWith('/login')) {
// LET IT BE
} else {
router.navigate(['login']);
}
runtimeCompiler.clearCache();
} else {
router.navigate(['menu']);
}
}
}
Thank you in advance.
I would say, that you should add the providers set to the app module:
This set
COMPILER_PROVIDERS
of providers contains all what is needed byRuntimeCompiler
. There is anexample
with workingplunker
using that piece of code How can I use/create dynamic template to compile dynamic Component with Angular 2.0? and some more details...