Not clear how to use material input
Timmmm opened this issue · 2 comments
This is one of the first things you'd want to do and it really isn't obvious how to do a basic binding to a <material-input>
.
I did the same as in #24, and tried [(inputText)]="foo"
and [(ngModel)]="foo"
, neither of which give compilation errors, but also neither of which work!
So apparently out you need to add install angular_forms
, add formDirectives
to the list of directives. I did that, but then it gives me this error:
dir.valueAccessor != null
"No value accessor for () or you may be missing formDirectives in your directives list."
Wait... I just added formDirectives
to my directives list!!!
Ok let me Google error number 15.... aha. You have to use materialInputDirectives
instead of MaterialButtonComponent
.
It finally works! Please can you update this page with at least some bare minimum "how to" like this:
To use use
<material-input>
you should install theangular_forms
package, thenimport 'package:angular_forms/angular_forms.dart';
addmaterialInputDirectives
to your components directive lists (do not addMaterialInputComponent
directly), and finally use<material-input [(ngModel)]="field">
in your HTML, wherefield
is a member of your component class.
That is specifically what the SOURCE link and the examples are for.... We don't want to put all the code in the doc comment itself.
I mean... yeah that's how I eventually worked it out, but it wasn't nearly as easy as if that paragraph were in the actual docs. I'm not sure I would call "read the source" good documentation. Up to you though I guess.