# Switching tabs issue

**URL:** <https://discourse.nodered.org/t/switching-tabs-issue/1964>\
**Category:** Dashboard\
**Created:** [1 August 2018 08:15 UTC](https://discourse.nodered.org/t/switching-tabs-issue/1964 "2018-08-01T08:15:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![realjax](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/realjax/32/895_2.png) [@realjax](https://discourse.nodered.org/u/realjax)\
**Post date:** [1 August 2018 08:15 UTC](https://discourse.nodered.org/t/switching-tabs-issue/1964/1 "2018-08-01T08:15:32Z")

</div>

Hi,

I have a ui-template containing this:

```auto
<div id="{{'my_'+$id}}">no data</div>

<script>
(function(scope) {
  scope.$watch('msg.payload', function(data) {
    if (data) {
      // Do something when msg arrives
      console.log(data)
       $("#my_"+scope.$id).html(data);
    }
  });
})(scope);
</script>

```

This works fine, but when I switch to a different tab and then come back to the tab containing this template the data is no longer written in div while it does appear in the console. Could this be due to a timing issue?
