question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API References should be painfully explicit about two-way binding.

See original GitHub issue

Currently, 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:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
jroodcommented, Mar 31, 2017

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 output selectedIndexChange 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">

0reactions
angular-automatic-lock-bot[bot]commented, Sep 5, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is two way binding? - Stack Overflow
Two-way binding just means that: When properties in the model get updated, so does the UI. When UI elements get updated, the changes...
Read more >
TwoWay - Reference Source - Microsoft
TwoWay,. src\Framework\System\Windows\Data\BindingExpressionBase.cs (2) ... from parent BindingBase - it can be changed later PresentationTraceSources.
Read more >
Template Syntax | AngularDart Community Documentation
Binding types can be grouped into three categories based on the direction of data flow: source-to-view, view-to-source, and two-way sequence ...
Read more >
Data Binding in Angular 2 Explained - Ciphertrick
Data Binding is a feature of modern frameworks which synchronizes the data displayed in the view and that holds with the model.
Read more >
Simple yet powerful state management in Angular with RxJS
Straight forward API to update state and select state: setState , select; Selected state should be returned as an Observable. The Observable ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found