2017-07-14 37 views
0

enter image description here enter image description here我該如何在AngularDart中的用戶配置文件圖像上實現angular_components的Popup。AngularDart Popup組件

https://dart-lang.github.io/angular_components_example/#Popups 這個鏈接的例子幫助我瞭解AngularDart組件及其實現,但我仍然無法在用戶配置文件圖像上實現它。所以任何人都可以幫助我知道該怎麼做

謝謝你提前。

app_header.dart

@Component(selector: 'app-header', 
templateUrl: 'app_header.html', 
styleUrls: const ['app_header.css'], 
directives: const [ 
    MaterialButtonComponent, 
    MaterialPopupComponent, 
    PopupSourceDirective, 
    DefaultPopupSizeProvider, 
], 
providers: const [ 
    popupBindings, 
    DefaultPopupSizeProvider, 
],) 


class AppHeader { 
final FirebaseService fbService; 
bool headerFooterPopupVisible = false; 

String get tooltipMsg => 'All the best messages appear in tooltips.'; 
String get longString => 'Learn more about web development with AngularDart' 
    'here. You will find tutorials to get you started.'; 

AppHeader(FirebaseService this.fbService); 
} 

@Injectable() 
PopupSizeProvider createPopupSizeProvider() { 
return const PercentagePopupSizeProvider(); 
} 
@Directive(selector: '[defaultPopupSizeProvider]', providers: const [ 
const Provider(PopupSizeProvider, useFactory: createPopupSizeProvider) 
]) 
class DefaultPopupSizeProvider {} 

app_header.html

<header class="navbar-dark bg-primary layout horizontal center justified"> 
<div class="horiz"> 
<div id="chat-bubble" class="icon"></div> 
<a class="navbar-brand">Dart Chat</a> 
</div> 

<div class="horiz"> 
<div id="sign-in" *ngIf="fbService.user == null" class="horiz"> 
    <div id="google-icon" class="icon"></div> 
    <button class="btn btn-outline-secondary btn-sm" 
(click)="fbService.signIn()">Google Sign In</button> 
</div> 

<div id="sign-out" *ngIf="fbService.user != null" class="horiz"> 
    <div id="user-name">{{fbService.user?.displayName}}</div> 
    <img class="icon" [src]="fbService.user?.photoURL"> 

    <button class="btn btn-outline-secondary btn-sm" (click)="fbService.signOut()">Sign Out</button> 

    <material-button class="blue" 
        raised 
        popupSource 
        #headerExampleSource="popupSource" 
        (trigger)="headerFooterPopupVisible = !headerFooterPopupVisible"> 
    {{headerFooterPopupVisible ? 'Close' : 'Open'}} Custom Popup 
    </material-button> 
    <material-popup defaultPopupSizeProvider 
        enforceSpaceConstraints 
        [source]="headerExampleSource" 
        [(visible)]="headerFooterPopupVisible"> 
    <div header class="custom-header"> 
     This is a Header demo 
    </div> 
    <div class="custom-body"> 
     Hello, Hello, Hello. This is a tall bit of content that needs a scroll 
     bar because the content is so long. 
    </div> 
    <div footer class="custom-footer"> 
     This is a Footer demo 
    </div> 
    </material-popup> 

</div> 

如果我使用下面的代碼。

錯誤:DirectiveProcessor上dart_chat_ng2_fb3 | LIB /視圖/ app_header/app_header.dart]: 錯誤:模板解析錯誤:第25行,第7列AppHeader的:ParseErrorLevel.FA TAL:空元素沒有結束標籤「 IMG」 ^^^^^^ [上dart_chat_ng2_fb3錯誤從TemplateCompiler | LIB /視圖/ app_component/app_co mponent.ng_meta.json]: 找不到名稱指令/管材條目:AppHeader 。請注意,飛鏢變壓器有限支持

<img [src]="fbService.user?.photoURL" class="blue" 
        raised 
        popupSource 
        #headerExampleSource="popupSource" 
        (trigger)="headerFooterPopupVisible = !headerFooterPopupVisible"> 
    {{headerFooterPopupVisible ? 'Close' : 'Open'}} Custom Popup 
    </img> 
    <material-popup defaultPopupSizeProvider 
        enforceSpaceConstraints 
        [source]="headerExampleSource" 
        [(visible)]="headerFooterPopupVisible"> 
    <div header class="custom-header"> 
     This is a Header demo 
    </div> 
    <div class="custom-body"> 
     Hello, Hello, Hello. This is a tall bit of content that needs a scroll 
     bar because the content is so long. 
    </div> 
    <div footer class="custom-footer"> 
     This is a Footer demo 
    </div> 
    </material-popup> 

,如果我僅僅是「材料按鈕」標籤切換到「按鈕」彈出沒有露面

+0

什麼問題?什麼是實際行爲?預期的行爲是什麼? –

+0

如果html標籤在其他任何材質按鈕中發生更改,彈出不起作用 –

+0

您試過了什麼html標籤? 「不工作」是什麼意思?你是否收到錯誤信息,或剛剛出現的彈出窗口? –

回答