Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style angular ng-template selector

I am struggling with styling ng-template tag.
what i have tried in my .css file until now:

  • using #other_content as ID in my .css file
  • adding a class to <ng-template>
  • styling all <td> tags

It's not working and after searching i have not found any solution.

HTML:

<div class="cont">
    <div class="scolldiv">
        <table border="1">
            <thead>
                <tr>
                    <th>Char</th>
                    <th>Break After</th>
                    <th>Remove</th>
                </tr>
            </thead>
            <tbody>
                <tr *ngFor="let charobj of Chars;let i = index" [attr.data-index]="i">
                    <td>{{charobj.char}}</td>
                    <td class="tdcell" *ngIf= "charobj.after; else other_content">YES</td>
                    <ng-template  #other_content>NO</ng-template>
                    <td>
                        <MyBtn
                            [ID]="'btnaddchars_' + i"
                            [BackColor]= "globals.sysButtonBackColor"
                            [Color]= "globals.sysButtonForeColor"
                            [HoverBackColor] = "globals.sysHoverButtonBackColor"
                            [HoverColor] = "globals.sysHoverButtonForeColor"
                            [Text] ="'Delete'"
                            [SecondText]="'Close'"
                            [Width] ="'70px'"
                            [Height]="'17px'"
                            (buttonWasClicked) ="onSymbolsFormButtonClick($event)"
                            >
                        </MyBtn>
                    </td>
                </tr>

            </tbody>
        </table>
    </div>
</div>

Image:

enter image description here

like image 853
Jonathan Applebaum Avatar asked Nov 25 '17 09:11

Jonathan Applebaum


1 Answers

Since the tag <ng-template> is converted into bindings when DOM is rendered something like this

<!--bindings={
  "ng-reflect-ng-if": "false",
  "ng-reflect-ng-if-else": "[object Object]"
}-->

Try to give a class(CSS class) to your text example:

<ng-template #other_content>
    <label class='_YOUR CSS CLASS_'>No</label>
</ng-template>
like image 145
Sagar Ahuja Avatar answered Sep 19 '22 21:09

Sagar Ahuja