Thanks Marc, but unfortunately that doesn't solve my problem. Rendering the node.id as a url is a secondary issue to the image src="" reference disappearing.
I assume there is a conflict in my code. I don't presume what I'm trying to do is that difficult, but when i choose a link after setting the image, the image disappears. If I don't set a link, there's no problem, however I don't get to add a link. :/
Extend media picker to include link selector
In my custom grid editor I have a media picker which selects and image and a content picker which selects a node from the tree.
The desired output is this:
if I choose an image and hit save, the image displays as it should on the web page.
If i select the link button and pick a 'node' from the tree, the image disappears from the back office and the resulting code is
As you can see, it's set the link url in the
My code is as follows:
editor.controller.js
view page .html
Thanks for your help. :)
Hi Elliot
You'll probably want to make use of the contentResource getNiceUrl method:
https://our.umbraco.org/apidocs/ui/#/api/umbraco.resources.contentResource#methods_getniceurl
this enables you to get the Url for a given content nodeid.
first inject the contentResource into your controller
then when you have your node.id...
that should return the published url of the node you have picked.
Thanks Marc, but unfortunately that doesn't solve my problem. Rendering the node.id as a url is a secondary issue to the image src="" reference disappearing.
With your solution I still end up with:
As you can see I still have no image link. The output I want is as follows:
I assume there is a conflict in my code. I don't presume what I'm trying to do is that difficult, but when i choose a link after setting the image, the image disappears. If I don't set a link, there's no problem, however I don't get to add a link. :/
Hi Elliott
Apologies I think I completely misread the question!
is it that ?
is wiping out the previously set image property of value... add
after each interaction and you will see where the image property is disappearing
try
$scope.setImageLink = function () { $scope.control.value.linkUrl = linkUrl";
and in the contentpicker callback
this way you keep the previous value of
after a link is picked!
Thanks, I just arrived at that conclusion myself!
So yes! It was forgetting it!
I set the url as a global variable and restated the value of the variable in setImageLink function and voila! :)
Thank you for your help, I'm on a miniature high right now as this has been, this has been 4 days of pain for me! haha.
Hi Elliott
Great when it works :-)
sorry I didn't spot it on the first pass!
regards
Marc
is working on a reply...