3
如何寫ternany條件<img>
src
在角2.條件圖片src結合在角2
下面是我嘗試的代碼,但這是不工作
<img class="lib-img" [src]="item.pictureUrl!= null ? item.pictureUrl : ~/images/logo.png" height="500" width="500" alt="default image">
如何寫ternany條件<img>
src
在角2.條件圖片src結合在角2
下面是我嘗試的代碼,但這是不工作
<img class="lib-img" [src]="item.pictureUrl!= null ? item.pictureUrl : ~/images/logo.png" height="500" width="500" alt="default image">
[src]="item.pictureUrl!= null ? item.pictureUrl : myImgUrl"
。 ts
export class App{
myImgUrl:stirng='~/images/logo.png';
}
[src]="item.pictureUrl ? item.pictureUrl : 'assets/img/logo.png'"
也許更好的辦法是,讓您的圖片資產的文件夾:資產/ IMG/logo.png
我,可以看到圖像的位置,但沒有圖像loaded.In SRC有一個影像的位置。 –
不知道你在說什麼。 – micronyks
在html src ='〜/ images/logo.png'中。但圖像不加載 –