Tuesday, July 25, 2017

TS2341:Property 'input' is private and only accessible with class 'Typeahead'.

This isn't true at all! If you have a Typeahead with a local reference of #whatever in an Angular 2 app then...

let input = this.whatever.input;

 
 

...in TypeScript lets you have at the setting. Don't be fooled by this tooltip.

 
 

Addendum 7/28/2017: It is better to use let input = this.whatever.value.text; for something like this as it turns out as the code above (which seems to work in spite of making TypeScript cranky) will not compile in build-to-dist-file scenarios. I spoke too soon!

 
 

Addendum 12/7/2018: A typeahead is like an autocomplete.

No comments:

Post a Comment