Apparently, this was a good week to trip over a lot of cryptic Angular 2 Beta 1 error messages. On the tails of my last post, about "No provider for ParamDecorator" errors, I tripped over another parameter-related error. This time, I was accidentally referring to an undefined value in my Inject() metadata constructor:
WidgetComponent.parameters = [ new ng.core.Inject( ng.core.NgModel ) ];
... which resulted in the following error:
EXCEPTION: Token must be defined!
This is a particularly dubios error as the message doesn't indicate any relation to dependency-injection and the stack trace doesn't point to any particular part of the code. Luckily, it was only a small demo and I was able to narrow it down to the NgModel reference, which should have been in the "common" module:
WidgetComponent.parameters = [ new ng.core.Inject( ng.common.NgModel ) ];
This might not be an error you ever see if you're using ES6 modules. But, I figured it might be worth documenting since its a somewhat unhelpful error message.