Reload ng-init


(Johan Stigert) #1

I am trying to reload an Item:String that represents an image-url. Currently the Item definition looks like this:

String Img_test2 "[%s]" { http="<[http://127.0.0.1:9090/flickr?year=2018:5000:JSONPATH($.data)]" }

And in custom widget code the following reloads the image as expected every five seconds:

<img width="100%" src="{{itemValue('Img_test2')}}"></img>

What I do not understand is why the following code in custom widget dose NOT reload the image(with or without the added “refresh”):

<div ng-init="model_2018 = {'url': itemValue('Img_test2'), 'refresh': 5}">
      <widget-image ng-model="model_2018" style="margin:auto;"/>
</div>

Any idea why the ng-init dose not reload the displayed image?


(Johan Stigert) #2

Lets try another approach:
Is it possible with AngularJS to regularly request a url in some way?
(Guess that is what the Items are supposed to do but no luck in the first post.)