Andrei Costescu wrote:Do you really need it to be a "tagstring" instead of "string" in spec? (so do you use i18n, tags %% or html code with callbacks in it?)
What value do you assign to that property? It should be a string value.
<div>
<iframe src="{{model.url}}" width="{{model.width}}" height="{{model.height}}" frameborder="{{model.frameborder}}" allowfullscreen></iframe>
</div>
{
"name": "clickdigital-i-Frame",
"displayName": "iFrame",
"version": 1,
"definition": "clickdigital/iFrame/iFrame.js",
"libraries": [],
"model":
{
"height" : {"type": "string", "default":""},
"width" : {"type": "string", "default":""},
"frameborder" : {"type": "string", "default":""},
"url" : {"type": "tagstring", "default":""},
"styleClass" : { "type" :"styleclass", "tags": { "scope" :"design" }, "values" :["TBC"},
"toolTipText" : { "type" : "tagstring"},
"visible" : "visible"
},
"handlers" : {},
"api" : {}
}
elements.yourCompName.url = "http://www.bbc.co.uk";
// or
elements.yourCompName.url = "%%myURLDP%%";
// or something like
elements.yourCompName.url = new URL('../cats', 'http://www.example.com/dogs');
// or something else
(...)
Using AngularJS markup like {{hash}} in a src attribute doesn't work right: The browser will fetch from the URL with the literal text {{hash}} until AngularJS replaces the expression inside {{hash}}. The ngSrc directive solves this problem.
Andrei Costescu wrote:What value do you assign to that property? It should be a string value.
So is it
- Code: Select all
elements.yourCompName.url = "http://www.bbc.co.uk";
// or
elements.yourCompName.url = "%%myURLDP%%";
// or something like
elements.yourCompName.url = new URL('../cats', 'http://www.example.com/dogs');
// or something else
(...)
Or is it set in designer directly?
Did you try what https://wiki.servoy.com/pages/viewpage. ... d=23397000 suggests? So elements.yourCompName.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true)? You should try this also in combination with html area/label.
elements.yourCompName.url = "http://www.bbc.co.uk";
elements.yourCompName.url = "%%myURLDP%%";
"url" : {"type": "tagstring", "default":""}
"url" : {"type": "string", "default":""}
application.putClientProperty(APP_UI_PROPERTY.TRUST_DATA_AS_HTML, true);
Andrei Costescu wrote:Ah https://docs.angularjs.org/api/ng/directive/ngSrc.Using AngularJS markup like {{hash}} in a src attribute doesn't work right: The browser will fetch from the URL with the literal text {{hash}} until AngularJS replaces the expression inside {{hash}}. The ngSrc directive solves this problem.
So if label/html-area still don't work for you then in the custom component use "ng-src=" instead of "src=".
<iframe ng-src="http://{{model.url}}" width="500" height="500"></iframe>
Andrei Costescu wrote:I made the component work. The key is using $sce.trustAsResourceUrl($scope.model.url) in component js.
The APP_UI_PROPERTY.TRUST_DATA_AS_HTML doesn't work because the component didn't use it... I didn't think of that when writing the previous comment...
(if the component were to respond to that APP_UI_PROPERTY.TRUST_DATA_AS_HTML it would have to use either "trustAsHtml" filter provided by Servoy or code like I did when changing the component in combination with "svyServoyapi.trustAsHtml()" flag - but all this is not needed at all in your case because in your case you always need to trust that URL in order for it to show something - it's not like a component showing a DP with data that you don't know if it contains malicious HTML but with the same component you might want to show HTML if you know if it is safe; so in your case the $sce.trustAsResourceUrl is enough)
<object width="640" height="360">
<param name="movie" value="http://www.youtube.com/embed/[...]"/>
<param name="allowFullScreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed width="640" height="360" src="http://www.youtube.com/embed/[...]" class="youtube-player" type="text/html" allowscriptaccess="always" allowfullscreen="true"/>
</object>
Andrei Costescu wrote:You also mentioned that you ended up writing this component as what used to work in WC (label, html-area) no longer worked.
Could you detail a bit or give a sample with how you tried that? I would expect it to work in NG like that as well.
Were you trying something like this (if you were using youtube)?
- Code: Select all
<object width="640" height="360">
<param name="movie" value="http://www.youtube.com/embed/[...]"/>
<param name="allowFullScreen" value="true"/>
<param name="allowscriptaccess" value="always"/>
<embed width="640" height="360" src="http://www.youtube.com/embed/[...]" class="youtube-player" type="text/html" allowscriptaccess="always" allowfullscreen="true"/>
</object>
<iframe width="420" height="315"
src="https://www.youtube.com/embed/XGSy3_Czz8k">
</iframe>
Users browsing this forum: No registered users and 9 guests