HABPanel. Right syntax in widget to send item values via html

Hi everyone,

I’m trying to open a html file from a widget. A paramenter called “fav” (a number) needs to be sent from the widget to the html, but I can not come up with the right syntax so it sends the value instead of a string with the wrong data or an error.

The first {{config.fav_number}} shows the value of the number, but the second one shows an error. I also tried other funny things like …?fav=’+{{config.fav_number)}}+’">… and other crazy stuff but nothing seems to work.

Does anyone know how to send the number?

Thanks

This is my code:

Favourite {{config.fav_number}}

<iframe id="myFrame" style="background:white; width: 100%;height: 120px; border:none; " src="/static/FavEdit.html?fav={{config.fav_number)}}>text</iframe> </div></blockquote>

If this is about HABpanel, you may want to change your posting topic to get the right attention.

1 Like

Ok, thanks.

Try ngSrc:

<iframe id="myFrame" ng-src="{{'/static/FavEdit.html?fav=' + config.fav_number}}">text</iframe>

Note that this can only work for same-origin URLs (yours is), links to external domains would be blocked by AngularJS’ Strict Contextual Escaping unless they are manually trusted - and you can’t do that from a template.

Thanks for your answer. Sadly it didn’t work. I might have to use AngularJS since i’m getting this error:

Error: [$controller:ctrlreg] http://errors.angularjs.org/1.5.11/$controller/ctrlreg?p0=AppCtrl
G/<@http://192.168.1.34:8080/habpanel/vendor/vendor.js:6:426
tf/this.$get</<@http://192.168.1.34:8080/habpanel/vendor/vendor.js:91:126