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.

one way data binding by default

See original GitHub issue

Use one way data binding only and by default as angular 1.5 uses

https://github.com/angular/angular.js/commit/4ac23c0ac59c269d65b7f78efec75d060121bd18#diff-a732922b631efed1b9f33a24082ae0dbL3037

angular doesn’t copies those parent values, so if we have object and modify a property it will be mutated on parent, which is not very convenient. We wanna push best practices and stay immutable, so we will copy @Input props via angular.copy.

Although we should keep fallback for people which really need 2 way binding:

// one way only
@Component({ 
  selector: 'hero', 
  template:`hello`
})
class HeroComponent{
  @Input() name: string;
  @Input() skills: string[];
}
// two-way fallback via alias only
@Component({ 
  selector: 'hero', 
  template:`hello`
})
class HeroComponent{
  @Input('=') name: string;
  @Input('=') skills: string[];
}

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
Hotellcommented, Jun 13, 2016

yeah you’re right, so in your particular scenario just don’t use OnPush and use ChangeDetectorRef.

I will explore possibilities if it’s possible to tweak it to be more aligned with Angular 2, but that’s not the primary focus right now ( after ngMetadata 2.0 will be released )

Anyway, thanks for brilliant brainstorming ! These kind of conversations are golden!

Read more comments on GitHub >

github_iconTop Results From Across the Web

One-way and Two-way Data Binding in Angular | Pluralsight
One -way and two-way data binding are two of the important ways by which we can exchange data from component to DOM and...
Read more >
Difference between One-way Binding and Two-way Binding
In one-way binding, the data flow is one-directional. · This means that the flow of code is from typescript file to Html file....
Read more >
BindingMode Enum (System.Windows.Data) - Microsoft Learn
A programmatic way to determine whether a dependency property binds one-way or two-way by default is to get the property metadata of the...
Read more >
Step 5: One-Way Data Binding - Documentation - SAPUI5 SDK
Any other binding instances will continue to use the model's default binding mode. For more information, see API Reference: sap.ui.base.ManagedObject.
Read more >
aurelia - One way binding mode, the other way around
bind - Uses the default binding. One-way binding for everything but form controls, which use two-way binding. .one-way - Flows data one direction: ......
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