Private/Angular/Component/List/Table/New-NgTableComponentHtmlToString.ps1

Function New-NgTableComponentHtmlToString([WebCsprojInfo]$webCsprojInfo, [TableInfo]$tableInfo, [string]$newUrl)
{
    [string]$result = @"
<h2>$($tableInfo.tablePretty) List</h2>

 <div class="table-responsive" *ngIf="$($tableInfo.tableLowerCamel)s; else $($tableInfo.tableLowerCamel)sLoading">
    <table class="table table-striped" style="max-width: none; width: 0px">
      <thead>
        <tr>
"@


    # Add column headers
    foreach ($columnInfo in $tableInfo.columnInfos)
    {
        $result = $result + "<th>$($columnInfo.caption)</th>"
    }
    $result = $result + @"
        </tr>
    </thead>
"@


    # Add one row that uses angular repeater
    $result = $result + @"
      <tbody>
        <ng-container *ngFor="let $($tableInfo.tableLowerCamel) of $($tableInfo.tableLowerCamel)s">
          <tr>
"@
        
    foreach ($columnInfo in $tableInfo.columnInfos)
    {
        $result = $result + "<td>{{$($tableInfo.tableLowerCamel).$($columnInfo.columnLowerCamel)}}</td>"
    }

    $result = $result + @"
          </tr>
        </ng-container>
      </tbody>
    </table>

    <a class="btn btn-primary" routerLink="$($newUrl)" routerLinkActive="active">New $($tableInfo.tablePretty)</a>
  </div>
  <ng-template #$($tableInfo.tableLowerCamel)sLoading>
    Loading ...
  </ng-template>
"@

    return $result 
}