Hi @QNimbus and @ysc I’m trying to implement encodeURIComponent() function in my widget, which I’m going to be used for sending http url requests to squeezebox players. The widget will be a Button containing radio station image. By clicking on the widget I want send to squeezebox appropriate link to radio stream in URI format. Parts of the url are taken from defined widget settings and the only I need is to transform http addresses into URIs.
I’ve made the follwing js:
angular.module("encodeuri", []).filter("encodeuri", function() {
return function(input) {
return encodeURIComponent(input);
};
});
and I’ve made custom widget which looks like this:
<div class="squeezebox-playstream" oc-lazy-load="['/static/converturi.js']">
<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;
display: flex; margin: 0; padding: 0; overflow:hidden">
<button class="btn btn-lg" style="width: 100%; height: 100%; padding: 0; background: inherit; border:0; outline: none; overflow:hidden"
ng-click="sendCmd('uritestitem', config.server_address + config.address_prefix + {{config.station_address | encodeURIComponent}} + config.address_suffix + config.player_mac)">
<div ng-init="image={url: config.logo_url, refresh: config.refresh_period}" style="width: 100%; height: 100%">
<widget-image ng-model="image"></widget-image></div>
</button>
</div>
</div>
This however doesn’t work. It looks like there is some error even in the javascript itself or in ng-click definition. Can you help me to detect what is wrong? Or maybe you know better way of getting encodeURIComponent function.