Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding with template preview #132

Open
jessicapaolam opened this issue Apr 17, 2019 · 0 comments
Open

Binding with template preview #132

jessicapaolam opened this issue Apr 17, 2019 · 0 comments
Labels

Comments

@jessicapaolam
Copy link

jessicapaolam commented Apr 17, 2019

I have a form with a div and an img where the user's current photo is. I created an icon at the top of the img which, when clicked, activates the dropzone directive and opens the box to choose a new photo. The problem is that when selecting the photo, a dynamic div is generated by the drop zone itself, as the documentation explains, and what I want is for the image to be reloaded in the img and in the template I've already created. I'm trying to use the previewTemplate but this is not what I want, I do not want to create a new template and I want the image to be reloaded inside my div with the current img. It's possible? How can I bind an id in previewTemplate to reference my div with img that already exists to only change the src of img? I'm using angular version 8.

Example:

< div fxLayout="column" >
< img [src]='assets/images/{{photo}}.jpg' />
< mat-icon class="material-icons" [dropzone]="config" (init)="onUploadInit($event)" color="primary">photo_camera
< / div>

Component:

public config: DropzoneConfigInterface = {
clickable: true,
maxFiles: 1,
autoReset: null,
errorReset: null,
cancelReset: null,
previewTemplate: ?
};

https://stackblitz.com/edit/angular-uvvw3w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants