Switching tabs issue

#1

Hi,

I have a ui-template containing this:

<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?

0 Likes