{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/observe/issues/54","labels_url":"https://api.github.com/repos/dart-lang/observe/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/observe/issues/54/comments","events_url":"https://api.github.com/repos/dart-lang/observe/issues/54/events","html_url":"https://github.com/dart-lang/observe/issues/54","id":85652371,"number":54,"title":"toObservable() does not work correctly with a Map and template repeat","user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dart-lang/observe/labels/Area-Polymer","name":"Area-Polymer","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/observe/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/dart-lang/observe/labels/Fixed","name":"Fixed","color":"ededed"},{"url":"https://api.github.com/repos/dart-lang/observe/labels/Library-PolymerExpressions","name":"Library-PolymerExpressions","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"jmesserly","id":1081711,"avatar_url":"https://avatars.githubusercontent.com/u/1081711?v=3","gravatar_id":"","url":"https://api.github.com/users/jmesserly","html_url":"https://github.com/jmesserly","followers_url":"https://api.github.com/users/jmesserly/followers","following_url":"https://api.github.com/users/jmesserly/following{/other_user}","gists_url":"https://api.github.com/users/jmesserly/gists{/gist_id}","starred_url":"https://api.github.com/users/jmesserly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmesserly/subscriptions","organizations_url":"https://api.github.com/users/jmesserly/orgs","repos_url":"https://api.github.com/users/jmesserly/repos","events_url":"https://api.github.com/users/jmesserly/events{/privacy}","received_events_url":"https://api.github.com/users/jmesserly/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-06-05T23:01:16Z","updated_at":"2015-06-05T23:01:18Z","closed_at":null,"body":"_Originally opened as dart-lang/sdk#15407_\n\n*This issue was originally filed by shaile...&#064;google.com*\n_____\nThis code should work, but does not:\n\n&lt;polymer-element name=&quot;my-example&quot;&gt;\n&nbsp;&nbsp;&lt;script type=&quot;application/dart&quot; src=&quot;myexample.dart&quot;&gt;&lt;/script&gt;\n&nbsp;&nbsp;&lt;template&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;style&gt;&lt;/style&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;div&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;template repeat=&quot;{{ entry in map.values }}&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;{{ entry }}&lt;/li&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/template&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;button on-click=&quot;{{add}}&quot;&gt;Add&lt;/button&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;\n&nbsp;&nbsp;&lt;/template&gt;\n&lt;/polymer-element&gt;\n\n@CustomTag('my-example')\nclass MyExample extends PolymerElement {\n&nbsp;&nbsp;@­observable Map&lt;int, String&gt; map = toObservable({});\n&nbsp;&nbsp;int i = 0;\n\n&nbsp;&nbsp;MyExample.created() : super.created();\n\n&nbsp;&nbsp;void add() {\n&nbsp;&nbsp;&nbsp;&nbsp;map[i++] = i.toString();\n&nbsp;&nbsp;}\n}\n\nRewriting the example using a list instead of a map, appending the value of i to that list, and using template repeat correctly displays the elements of the list in the UI. So, toObservable() works with a list, but does not work with a Map in this context.\n\nAlso, changing the value of existing keys updates the UI. So, for instance, changing the toObservable() part to the following: \n\n&nbsp;@­observable Map&lt;int, String&gt; map = toObservable({1: 'one':  2: 'two'});\n\ncorrectly shows the map values in the &lt;ul&gt;. When map[1] and map[2] are changed by add(), the new values are correctly displayed. \\*New\\* map entries, however, still are not displayed.\n\n\n&nbsp;\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/observe/issues/comments/109472762","html_url":"https://github.com/dart-lang/observe/issues/54#issuecomment-109472762","issue_url":"https://api.github.com/repos/dart-lang/observe/issues/54","id":109472762,"user":{"login":"DartBot","id":8958862,"avatar_url":"https://avatars.githubusercontent.com/u/8958862?v=3","gravatar_id":"","url":"https://api.github.com/users/DartBot","html_url":"https://github.com/DartBot","followers_url":"https://api.github.com/users/DartBot/followers","following_url":"https://api.github.com/users/DartBot/following{/other_user}","gists_url":"https://api.github.com/users/DartBot/gists{/gist_id}","starred_url":"https://api.github.com/users/DartBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DartBot/subscriptions","organizations_url":"https://api.github.com/users/DartBot/orgs","repos_url":"https://api.github.com/users/DartBot/repos","events_url":"https://api.github.com/users/DartBot/events{/privacy}","received_events_url":"https://api.github.com/users/DartBot/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T23:01:18Z","updated_at":"2015-06-05T23:01:18Z","body":"*This comment was originally written by blink.ey...&#064;gmail.com*\n_____\nSame issue: https://groups.google.com/a/dartlang.org/forum/#!topic/web/zTqgqnxeNcw"}}