首页 文章

AngularDart弹出组件

提问于
浏览
0

enter image description here

enter image description here
如何在AngularDart中的用户配置文件图像上实现angular_components的弹出窗口 .

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>

如果我使用以下代码 .

错误:dart_chat_ng2_fb3上的DirectiveProcessor | lib / views / app_header / app_header.dart]:错误:模板解析错误:AppHeader的第25行第7行:ParseErrorLevel.FA TAL:Void元素没有结束标记“img”^^^^ ^^ [来自DMP_chat_ng2_fb3上的TemplateCompiler的错误| lib / views / app_component / app_co mponent.ng_meta.json]:找不到名称的指令/管道条目:AppHeader . 请注意,Dart变压器的支持有限

<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>

如果我只是将“material-button”标签更改为“button”,则弹出窗口不显示

1 回答

相关问题