{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ionic/issues/3670","labels_url":"https://api.github.com/repos/driftyco/ionic/issues/3670/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic/issues/3670/comments","events_url":"https://api.github.com/repos/driftyco/ionic/issues/3670/events","html_url":"https://github.com/driftyco/ionic/issues/3670","id":73630108,"number":3670,"title":"bug: View caching and getElementById","user":{"login":"craig-at-rsg","id":6004181,"avatar_url":"https://avatars.githubusercontent.com/u/6004181?v=3","gravatar_id":"","url":"https://api.github.com/users/craig-at-rsg","html_url":"https://github.com/craig-at-rsg","followers_url":"https://api.github.com/users/craig-at-rsg/followers","following_url":"https://api.github.com/users/craig-at-rsg/following{/other_user}","gists_url":"https://api.github.com/users/craig-at-rsg/gists{/gist_id}","starred_url":"https://api.github.com/users/craig-at-rsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craig-at-rsg/subscriptions","organizations_url":"https://api.github.com/users/craig-at-rsg/orgs","repos_url":"https://api.github.com/users/craig-at-rsg/repos","events_url":"https://api.github.com/users/craig-at-rsg/events{/privacy}","received_events_url":"https://api.github.com/users/craig-at-rsg/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/driftyco/ionic/labels/needs%20reply","name":"needs reply","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-06T13:58:46Z","updated_at":"2015-05-08T14:22:13Z","closed_at":null,"body":"**Type**: <span ionic-type>bug</span>\r\n\r\n**Platform**: <span ionic-platform>mobile</span>  <span ionic-webview>webview</span>\r\n\r\n<span ionic-description>I'm using Google javascript maps in my Ionic app, and they stopped working when I upgraded to 1.0RC5 from an earlier 1.0 beta. When I turn off caching for this view then the maps work again, but I'd like to use caching.  \r\n\r\nI'm using REST style URLs in my app, so the link for my page with the map looks like '#/page/{{item.id}}'. With caching on, the maps load fine on the first of these pages I open, and they continue to work if I reopen the page with that id, but they have an empty div instead of a map for pages with other ids. \r\n\r\nI can see my map-creation function completes without error in both cases. Here's the bit in my controller that I assume is at issue:\r\n    map = new google.maps.Map(document.getElementById(\"map\"), mapOptions)\r\n\r\nIs the div returned by this getElementById call not the one being shown? Or is something else going on?\r\n\r\n</span>\r\n\r\n<span is-issue-template></span>\r\n"},"comment":{"url":"https://api.github.com/repos/driftyco/ionic/issues/comments/100245924","html_url":"https://github.com/driftyco/ionic/issues/3670#issuecomment-100245924","issue_url":"https://api.github.com/repos/driftyco/ionic/issues/3670","id":100245924,"user":{"login":"craig-at-rsg","id":6004181,"avatar_url":"https://avatars.githubusercontent.com/u/6004181?v=3","gravatar_id":"","url":"https://api.github.com/users/craig-at-rsg","html_url":"https://github.com/craig-at-rsg","followers_url":"https://api.github.com/users/craig-at-rsg/followers","following_url":"https://api.github.com/users/craig-at-rsg/following{/other_user}","gists_url":"https://api.github.com/users/craig-at-rsg/gists{/gist_id}","starred_url":"https://api.github.com/users/craig-at-rsg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craig-at-rsg/subscriptions","organizations_url":"https://api.github.com/users/craig-at-rsg/orgs","repos_url":"https://api.github.com/users/craig-at-rsg/repos","events_url":"https://api.github.com/users/craig-at-rsg/events{/privacy}","received_events_url":"https://api.github.com/users/craig-at-rsg/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T14:22:13Z","updated_at":"2015-05-08T14:22:13Z","body":"This sample shows the bug on both android and ios, just click back and forth between the links. The console will log that the text in the div is being replaced, but it won't be replaced for the 2nd link.\r\n\r\n```\r\nangular.module('starter', ['ionic'])\r\n    .config(function ($stateProvider) {\r\n        $stateProvider\r\n            .state('page', {\r\n                url: '/page/:param',\r\n                template: \"<div id='container'>Text not replaced</div><a href='#/page/cached'>Works</a><br /><a href='#/page/other'>Doesn't</a>\",\r\n                controller: 'PageController'\r\n            });\r\n    })\r\n.controller('PageController', ['$scope', function ($scope) {\r\n\t   $scope.$on('$ionicView.enter', function() {\r\n           console.log('Replacing text');\r\n        document.getElementById(\"container\").textContent = 'Text replaced';\r\n           console.log('Replaced text');\r\n       });\r\n    }])\r\n.run(['$state', '$ionicPlatform', function($state, $ionicPlatform) {\r\n  $ionicPlatform.ready(function() {\r\n      $state.go('page', {param: 'cached'});\r\n  });\r\n}]);\r\n```"}}