Thanks Sander, actually I need fixed and unique I’d for each table and some
mechanism to know which I’d belongs to which table in component ts file ,
currently all tables on the page has same id, which is string 'unique' ,
but it is fixed string , so whenever I do getelementbyID('unique') , I get
only fist table , though what I want reference of individual table whenever
i do any interactive action on that .
Below is my template:
<caption>{{ settings.metadata.label }}</caption>
<table *ngIf="settings" class="table" [id]="getId('name')" value="1" type=
"hidden" placeholder=
"Hidden input recording the html id for dynamic delete buttons">

  <thead>
    <tr>
      <th>Action</th>
      <th *ngFor="let header of settings.headers;let k=index"> {{ header }}
</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let record of settings.series;let i=index">
      <td (click)="deleteRow(i)">
        <button class='btn btn-danger btn-sm delete'>X</button>
      </td>
      <td contenteditable='true' *ngFor=
"let item of record | keyvalue: originalOrder">
        {{item.value}}
      </td>
    </tr>
    <tr>
      <td>
        <button style="margin-right: 5px" (click)="addRow()" class=
'btn btn-success btn-sm'>+</button>
        <button style="margin-right: 5px" (click)="push()" class=
'btn btn-dark btn-sm'>PUSH</button>
      </td>
    </tr>

  </tbody>

</table>


On Thu, 16 Apr 2020 at 8:24 AM, Sander Elias <sanderel...@gmail.com> wrote:

> Hi Rahul,
>
> Id's need to be unique, but HTML isn't enforcing anything.
> But even when the id is unique, how are you going to know that for your
> `document.getElementByID('unique')` because if it is unique it will never
> be the same?
> You need to know a bit more about a page to get a certain table out of it.
> Also, I'm pretty sure, you are better off doing, whatever it is, inside the
> angular components/services that create the page.
>
> Regards
> Sander
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/angular/50c5c0f5-5bb4-46e9-a32e-c147b22f64df%40googlegroups.com
> <https://groups.google.com/d/msgid/angular/50c5c0f5-5bb4-46e9-a32e-c147b22f64df%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/CAGH8rEyhfJ7DnTFH4Zu5wN0K_WD1NRX8hgpoC3qs2-GZqgLaHw%40mail.gmail.com.

Reply via email to