Open krutika20 opened 6 years ago
Check the example app.
Can you please check my Code? html code <ng-template #content1 let-c="close" let-c="dismiss" id="emailModel">
component.ts import { DropzoneConfigInterface,DropzoneModule ,DropzoneComponent , DropzoneDirective } from 'ngx-dropzone-wrapper';
export class DetailpurchaseComponent implements OnInit{
@ViewChild(DropzoneComponent) fileInput:DropzoneComponent;
dropzoneConfig:DropzoneConfigInterface;
}
sendEmail(emailData){ console.log(this.fileInput.directiveRef.dropzone.getQueuedFiles().length); //this.fileInput.directiveRef.dropzone.processQueue(); console.log(emailData); }
Module.ts import { DropzoneModule } from 'ngx-dropzone-wrapper'; import { DropzoneConfigInterface,DropzoneComponent } from 'ngx-dropzone-wrapper';
const DROPZONE_CONFIG_PROD: DropzoneConfigInterface = { dictRemoveFileConfirmation: "Are you sure you want to remove this?", // Change this to your upload POST address: maxFilesize: 300, method: 'post',
headers:{'Cache-Control': null, 'X-Requested-With': null}, paramName: 'media', addRemoveLinks: true, createImageThumbnails: true, };
@NgModule({ declarations: [
], imports: [DropzoneModule.forChild()], providers: [
] ,
})
And i am getting error Cannot read property 'directiveRef' of undefined becuase my fileinput is defined in ng-template, i have example app but i am not clear with that code that how to solve this error.
Please reply as soon as possible.
Are you using some old version? Since new versions don't have the forChild function so I believe you are using some really old version that does not even have the directiveRef support in.
directiveRef supported if my dropzone component is not in ng-template.
Ah ok, then all should be ok. I guess you need to seek support from Angular forums then I have not needed to reference components inside of template so can not help you with that. I mean you might have better luck with Angular forums since ViewChild usage is specific to library its common Angular feature.
any fix for this?
any solution for this ?
this.drpzone.directiveRef.dropzone().processQueue();
directiveRef for invalid component, because dropzone is defined in ng-template how to use this functionality for ng-template?