Scipion Scipion - 1 month ago 20
TypeScript Question

Angular2 app won't work

Hey I have a very tiny angular (2.1.1) app with a module and a component. Everything was working fine, until I got this error :

error_handler.js:53 TypeError: jit_selectOrCreateRenderHostElement5 is not a function
at _View_AppComponent_Host0.createInternal (/AppModule/AppComponent/host.ngfactory.js:13:16)
at _View_AppComponent_Host0.System.register.context_1.execute.AppView.create (http://localhost:9000/assets/lib/angular__core/src/linker/view.js!transpiled:138:33)
at _View_AppComponent_Host0.System.register.context_1.execute.DebugAppView.create (http://localhost:9000/assets/lib/angular__core/src/linker/view.js!transpiled:348:56)
at ComponentFactory.create (http://localhost:9000/assets/lib/angular__core/src/linker/component_factory.js!transpiled:170:48)
at ApplicationRef_.bootstrap (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:455:52)
at eval (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:364:101)
at Array.forEach (native)
at PlatformRef_._moduleDoBootstrap (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:364:54)
at eval (http://localhost:9000/assets/lib/angular__core/src/application_ref.js!transpiled:328:39)
at e.invoke (http://localhost:9000/assets/lib/zone.js/dist/zone.min.js:1:14497)


I did try to rollback all my latest changes and more, and it didn't fix anything.
I decided then to go back to the simplest possible app, but still unsucesfully :

app.module:

// ANGULAR DEPENDENCIES
import { NgModule} from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { FormsModule, ReactiveFormsModule } from "@angular/forms"
import { HttpModule } from "@angular/http"

// COMPONENTS
import { AppComponent } from "./app.component"

@NgModule({
declarations: [ // directives and components
AppComponent
],
imports: [ // modules, constants and routes
BrowserModule,
ReactiveFormsModule,
FormsModule,
HttpModule
],
bootstrap: [AppComponent]
})
export class AppModule {}


And app.component:

import { Component } from "@angular/core"

@Component({
selector: "app",
template: `'lol'`
})
export class AppComponent {
}


my html is basically just
<app></app>


Any idea what this error is about, I am very confused, especially since everything was working a couple hours ago without any problem.

EDIT:

main.ts

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'
import { AppModule } from './app.module'

platformBrowserDynamic().bootstrapModule(AppModule)

Answer

The problem came from the angular2-cookie library, indeed the version 1.2.4 was broken.