Initializing uploadObj

What's the best way to initialize:  
public uploadObj: UploaderComponent; 

I tried:
public uploadObj: UploaderComponent | null = null; (problems!)
public uploadObj: UploaderComponent = new UploadComponent(); (fails)


Using angular 14.  Thanks!


1 Reply

SP Sureshkumar P Syncfusion Team October 12, 2022 10:33 AM UTC

Hi JASON,

We suggest you use the below code to initialize the component instance in the angular 14 application.


Find the code example:

[component.html]

<ejs-uploader #defaultupload  (created)="componentCreated($event)"></ejs-uploader>

 

[component.ts]

 

export class AppComponent {

  @ViewChild('defaultupload')

  public uploadObj!: UploaderComponent;

 

  componentCreated(args){

    console.log(this.uploadObj);

  }

}

 


Find the sample in the attachment:

Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Regards,

Sureshkumar P


Attachment: uploader_9013ddb4.zip

Loader.
Up arrow icon