angularjs-de/angular2-tutorial

self.context.search is undefined

Opened this issue · 1 comments

Error in angular2-tutorial/04-expressions/src/app/app.component.ts:

EXCEPTION: Error in ./AppComponent class AppComponent - inline template:5:8 caused by: self.context.search is undefined

{{search.toUpperCase() + "!"}} should now be {{ search + "!" | uppercase }}. Not sure about search.length.

EDIT:
There must be a question mark after search: {{ search?.length || 0 }}

Do not know what you are trying, but we are initialising search as a string with a value, so this.search or {{search}} is defined in any case --> if you remove all chars in the input field the string is an empty string ... so no problems at all?

Maybe you can show us your complete component and template?