angularjs - how to force angular to re-bind/update even there is no change in the model -


ok -- might thinking why want trying render html using ng-html-bind (in haml):

#my-visualization-panel{'ng-bind-html' => 'htmlsource'} 

the htmlsource has html renders visualization using c3.js visualization library. htmlsource looks this

<script>   var my_data = localstorage.getitem('my_data');   c3.generate({     data: {       columns: my_data     }  }); </script> 

so problem update visualization re-setting localstorage['my_data']. however, while data my_data refers might change, actual htmlsource not, view fails update.

is there way force view update if model, ostensibly, not?

i recommend changing html anyway. example

<script>   var my_data = localstorage.getitem('my_data');// 2482486284968248968 (hash of my_data, guid, or serial number)   c3.generate({     data: {       columns: my_data     }  }); </script> 

this allow script operate expect, directly, without having big sweeping updates or hacks. if "force refresh", if html doesn't change, angular not re-execute script.

another possibility call localstorage.getitem('my_data') in angular controllers / directives, instead of indirectly hoping angular run via html updates. seems kind of control you're looking for.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -