pass functions to file upload custom ui content

UI Components for Angular
Post Reply
manichandra
Posts: 11
Joined: 02 May 2017, 23:46

20 Jul 2017, 21:24

Is there any way we can pass functions to ng-template similar to the way we pass let-file and let-idx="index".

I want to add a custom ui to the file upload content and want to pass remove() function to the ng-template as shown below

Code: Select all

<ng-template let-file let-idx="index" let-rmv="remove()" pTemplate="file">
              <div class="row">
                <div class="col-sm-6">
                  {{file.name}}
                  {{idx}}
                </div>
                <div class="col-sm-4">
                  <select class="form-control" id="documentType"
                    name="documentType">
                    <option value="" disabled selected>Select File Type</option>
                    <option *ngFor="let fileType of fileTypes" [value]="fileType.value">{{fileType.display}}</option>
                  </select>
                </div>
                <div class="col-sm-2">
                  <button type="button" pButton (click)="rmv(idx)" icon="fa-close"></button>
                </div>
              </div>
            </ng-template>
Image

paulswan
Posts: 94
Joined: 27 Apr 2017, 08:19

24 Jul 2017, 01:53

Why not just use the remove() function in the template itself? I do something similar in my application and it works fine.

Code: Select all

<button type="button" pButton (click)="remove(idx)" icon="fa-close"></button>

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 14 guests