ng2-image-upload
ng2-image-upload copied to clipboard
How to pass the url to uploadedfiles attribute from component to render in edit screen
Hi,
I have uploaded the image in add screen to my server by specifying the server endpoint url in [url] attribute of image-upload. When I try to show the same image in my edit screen, If I put the complete url in [uploadedfiles] attribute then it is rendering properly. But If I pass the same url from component and try to render I am getting totally different behaviours like so many 404 urls generated in the console and also so many empty preview boxes appears in the UI.
The ways I tried is, Way 1: $storeLogoUrl -> Passing the name of the store from component. uploadedFiles="http://localhost:19999/store/logo/{{$storeLogoUrl}}"
Way 2: uploadedFiles="'http://localhost:19999/store/logo/'+$storeLogoUrl"
Way 3: [uploadedFiles]="'http://localhost:19999/store/logo/'+$storeLogoUrl"
Way 4: $storeLogoUrl - Full url I sent from controller itself. [uploadedFiles]="$storeLogoUrl"
Nothing worked out so far.
Can someone help me out here ?
Finally by specifying like this [uploadedFiles]="[storeLogoUrl]" I am able to see the image in the preview in edit screen. But still one more image preview empty box is appearing.....
Facing exactly the same issue. It gives one extra <div>
(so temporarily used jQuery to hide the above div)
$($('.img-ul-container').children(':first-child')).hide()
@agnaveen @monis01 if you want to fix this issue add a ternary: [uploadedFiles]="image? [image]: ''"
It works for me, thanks a lot @bolota