發表文章

目前顯示的是 1月 24, 2019的文章

Thymeleaf javascript replacing an image source based on text in table

圖片
2 this is my first post. I have been trying to look for an answer that but I can't find one. I am trying to replace an image source in my HTML dependent on text displayed in the td.status, for example "SUBMITTED" My HTML : <table id = "myTable"> <tbody> <tr> <th>Reference</th> <th>Version</th> <th>Last Modified</th> <th>Status</th> </tr> <tr th:each="td: $thedata"> <td><span th:text="$td.thedataPrimaryKey.ref"></span></td> <td><span th:text="$td.thedataPrimaryKey.version"></span></td> <td><span th:text="$td.thedataTimestamp"></span></td> <td><span><img class="myImage" th:src="@/assets/images/offbulb.png" style="width:15px; height:10px"; /></span><span th:text="$td.status"></span

Is it possible to select by id in Angulars ?

圖片
1 1 I'm playing around with Angular's (version 7) content projection. As far as I know, it's possible to select by attribute, class, and tag with the select attribute of <ng-content> . I've also tried to select by id: <ng-content select="#myID"></ng-content> From: <mycomponent> <div id="myid"> Test </div> </mycomponent> But it doesn't seem to work. Why does the selection of IDs not work? angular angular7 share | improve this question edited Nov 13 '18 at 17:48 Daniel W Strimpel 3,396 1 6 17 asked Nov 13 '18 at 16:53 Robin Robin 3,774 2 32 59 for me is very exotic to use <div id=...> in angular template - can you explain why you wanna use it? – Kamil Kiełczewski Nov 13 '18 at 16:58 I got asked this by someone. Why is it uncommon in Angular to do this? I expected that I can use some kind of CSS selector