Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Angular 1.5.5: One way binding behaves as two way binding  #14701

@AhmedRiyad

Description

@AhmedRiyad

bug

When you try to use one way binding in angular 1.5.5 for an Object in a component

for example:

angular.module('heroApp').component('heroDetail', {
  templateUrl: 'heroDetail.html',
  controller: HeroDetailController,
  bindings: {
    hero: '<'      //One Way Binding Object
  }
});
function HeroDetailController() {
  var ctrl = this;

  //Bug here
  ctrl.hero.location = "location"

}

When you try to edit the hero Object for example: hero.location = 'location', it will affect the parent Object. So the hero object in the parent will have this new property called location and has the value of 'location'

https://plnkr.co/edit/5kGPXdTCXGK3xGLCFMkJ?p=preview

The original object should not be modified

Angular: 1.5.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions