2017-09-06 101 views
0

我想隱藏圖像中SIGN IN按鈕左側的圖像元素,它是登錄前的圖像顯示。我怎麼能在AngularDart中做到這一點? enter image description here如何在登錄AngularDart之前隱藏圖像元素

app_component.html

<div header class="custom-header"> 
     <img class="icon" [src]="fbService.user?.photoURL"> 
     <div id="user-name">{{fbService.user?.displayName}}</div> 
     <div id="email">{{fbService.user?.email}}</div> 
    </div> 

app_component.css

.icon { 
    width: 40px; 
    height: 40px; 
    margin-right: 16px; 
} 
+0

你能完成這項工作? –

+0

不,我使用FirebaseService,和沒有找到任何示例或文件來編寫用於「fbService.isLoggedIn」的dart代碼 –

+0

我明白了,如果我找時間,我會看看。 –

回答

1
<img *ngIf="authService.isLoggedIn" class="icon" [src]="fbService.user?.photoURL"> 

<img *ngIf="authService.isLoggedIn | stream" class="icon" [src]="fbService.user?.photoURL"> 

如果isLoggedIn是一個流。

您將需要一個全球性的服務,它提供了isLoggedIn狀態,並注入到包含<img ...>元素成分(名稱authService下。