app/boot.ts
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
bootstrap(AppComponent);
app/app.component.ts
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: '{{title}}'
})
class AppComponent {
title: "app"
}
Error:
EXCEPTION: Token must be defined!
STACKTRACE:BrowserDomAdapter.logError @ angular2.dev.js:23514
ExceptionHandler.call @ angular2.dev.js:1147
(anonymous function) @ angular2.dev.js:14801
NgZone._notifyOnError @ angular2.dev.js:5796
collection_1.StringMapWrapper.merge.onError @ angular2.dev.js:5700
run @ angular2-polyfills.js:141
(anonymous function) @ angular2.dev.js:5719
NgZone.run @ angular2.dev.js:5681
ApplicationRef_.bootstrap @ angular2.dev.js:14906
bootstrap @ angular2.dev.js:25054
execute @ boot.ts:4
u @ system.src.js:4597
execute @ system.src.js:4597
y @ system.src.js:4597
...
This is another error that has caught me multiple times. I forgot (once again) to export my root component. It should be:
export class AppComponent {
If I taken the time to look just a bit more closely at the stack trace (instead of searching StackOverflow and not finding my exact problem), I would have noticed that it referenced one of the files I wrote, boot.ts:4
.
In my case that was just because of semi-colon at the end of following line:
import {Component} from 'angular2/core';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With