Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

<input ng-model="map['item']">s do not update map items #824

Closed
vicb opened this issue Mar 31, 2014 · 2 comments
Closed

<input ng-model="map['item']">s do not update map items #824

vicb opened this issue Mar 31, 2014 · 2 comments

Comments

@vicb
Copy link
Contributor

vicb commented Mar 31, 2014

Consider the following controller

@NgController(
    selector: '[test-controller]',
    publishAs: 'ctrl')
class TestController {
  final indirect = { 'a': true };
  bool a = true;
  var msg = "-";


  void toggle() {
    msg = "a = $a, indirect = ${indirect['a']} -> ";
    indirect['a'] = !indirect['a'];
    a = !a;
    msg += "a = $a, indirect = ${indirect['a']}";
  }
}

and the following html

<ul>
  <li><input type="checkbox" ng-model="ctrl.indirect['a']">= {{ ctrl.indirect['a'] }}</li>
  <li><input type="checkbox" ng-model="ctrl.a">= {{ ctrl.a }}</li>
</ul>
<button ng-click="ctrl.toggle()">Toggle</button>
<p>{{ ctrl.msg }}</p>

The indirect access does not get updated on (un)checking nor toggle

@vicb
Copy link
Contributor Author

vicb commented Apr 8, 2014

I've investigated this a bit more. The pb does not seem to be on the parser side, as you can see from the unit test. There could be something wrong in the directive ?

@mhevery
Copy link
Contributor

mhevery commented Apr 9, 2014

I have a fix for this. The issue is that map['key'] was treated as a pure function which is not correct.

@mhevery mhevery closed this as completed in 03f0a4c Apr 9, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants