Search code examples
angularhyperlinkprimeng-datatable

Hyperlink to primeng datatable column


how to add hyperlink to primeng datatable column to pass that column value to new window in angular 2 app?

<p-column field="name" header ="Name" [sortable]="true" [filter]="true" >
    <ng-template let-row="rowData" pTemplate type="body">
      {{row.name}}
    </ng-template>
  </p-column>

On click of name in the datatable , have to display name in the text box of new page. Can anyone provide code samples for this ?


Solution

  • After adding the router link , it is working fine.

     <p-column field="name" header ="Name" [sortable]="true" [filter]="true" >
            <ng-template let-row="rowData" pTemplate type="body">
              <a [routerLink]="['/newregform',row.name]">{{row.name}}</a>
            </ng-template>
         </p-column>