API References should be painfully explicit about two-way binding.
See original GitHub issueCurrently, in the API references, there are @Input
and @Output
listed in such a way that seems to take for granted that the reader knows that if there exists an @Input
called x
and an @Output
called xChange
that you should be able to use the banana-in-a-box [(x)]
syntax to do a two way binding. I imagine this is a touchy subject because some will feel that this is obvious, and yet I’ve been using Angular 2 for a number of months and it was not at all clear to me, even though I’ve used that syntax with [(ngModel)]
plenty of times.
On the API reference for tabs, it says selectedIndexChange was added to allow for two way binding. I’m sure some people will read that and think “that’s abundantly clear”, and indeed for some experienced Angular 2 developers, that probably does obviously imply that you can expect to use [(selectedIndex)]
, but I think for other readers it’s not so obvious.
This library is advertised on the angular.io page, which makes me think the target audience is just as much novice Angular 2 developers as it is experienced ones. Since this is the case, I think API references should err on the side of being painfully explicit. It should not merely be said that ‘two-way binding’ is enabled, but explicitly that [(thisSyntax)]
can be used.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:16 (14 by maintainers)
Top GitHub Comments
It doesn’t look like there is anything on a button that can be two way bound. An example on Tabs under MdTabGroup is that there is an input
selectedIndex
which you could use like this<md-tab-group [selectedIndex]="someValueOrVariable">
and an outputselectedIndexChange
which you could use like this<md-tab-group (selectedIndexChange)="someMethod()">
. What I think should be added is an entry that says: by the way, you can access both at the same time like this<md-tab-group [(selectedIndex)]="someVariable">
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.