小编Fab*_*üng的帖子

如何在有角度的材料中在 Snackbar 上添加 html 内容?

我为响应消息创建了烤面包机(小吃店)。我想在烤面包机(小吃店)上添加一个 html 内容,以便可以以正确的格式显示多条消息。

我试过了

var test ='<html> <body>' + '<h1>The Header</h1>'  +  '<p>The paragraph of text</p>' + '</body>  </html>';


this._toastr.error(test);
 _toastr : is my service.
 .error  : is my function in which I have to pass htmlContent 
Run Code Online (Sandbox Code Playgroud)

我的代码

var test = '<html> <body>' + '<h1>The Header</h1>'  +  '<p>The paragraph of text</p>' + '</body>  </html>';

this._toastr.error(test);
Run Code Online (Sandbox Code Playgroud)

输出应为:- 以下 xxx/xxx 的价格已于 2018 年 11 月 27 日输入。

  1. 你好,世界!
  2. 大家好!

我想要这个东西在烤面包机(小吃店)

需要像这样的输出应该在 html 表内容中

angular-material angular5

4
推荐指数
1
解决办法
7571
查看次数

在 Stackblitz 中导入角度材质

我在我的stackblitz链接中导入了材料(7.2.1)

我仍然看不到材料的确切用户界面

我试图弄清楚,但没有结果。这里是我创建的stackblitz

angular-material angular

4
推荐指数
1
解决办法
3010
查看次数

如何为席卡添加席分页器?

我是Angular的新手,正在寻找席卡上的分页。我看到的示例仅对表进行分页。

我有数百个代码,希望将其限制为每页8-10张卡片。如何做到这一点?这是我的html和ts代码。

.html文件

<div  class="flip-right" [ngClass]="mobileQuery.matches ? 'card-wrapper-mobile' : 'card-wrapper'" *ngFor="let items of datasource">
   <div class="card">
      <div class="front">
          <mat-card [ngClass]="mobileQuery.matches ? 'mobile-card' : 'desktop-card'">
                    <a routerLink="/viewPage">
                      <mat-card-header class="header">
                          <mat-card-title>{{items.name}} <mat-icon class="verified title" [inline]="true" >lock</mat-icon></mat-card-title>
                        </mat-card-header>
                            <mat-card-subtitle class="first-subtitle">Last updated on:{{items.Last_updated_on}}</mat-card-subtitle>
                            <mat-card-subtitle>Last updated by:{{items.Last_updated_by}}</mat-card-subtitle>
                        <mat-card-subtitle>{{items.created_by}}</mat-card-subtitle>

                    </a>
            </mat-card>
  </div>
  <div class="back">
      <mat-card [ngClass]="mobileQuery.matches ? 'mobile-card' : 'desktop-card'">
                <a routerLink="/viewPage">
                  <mat-card-header>
                      <mat-card-title>{{items.name}}<mat-icon class="verified" [inline]="true" >lock</mat-icon></mat-card-title>
                    </mat-card-header>

                </a>
        </mat-card>
      </div>
     </div>
    </div>
Run Code Online (Sandbox Code Playgroud)

.ts文件

  import { Component, OnInit,ViewChild } from '@angular/core';
  import { Subscription } from …
Run Code Online (Sandbox Code Playgroud)

pagination angular-material angular angular6 angular7

3
推荐指数
1
解决办法
700
查看次数

mat-sort-header / mat-sort不适用于来自其他数据库的特定列

mat-sort无法处理mat-table来自另一个数据库的的一个列,其余的列则工作正常。唯一的区别是,我正在从另一服务获取该列的数据。

我试图解决它,ngAfterViewInit但无济于事。

ngAfterViewInit(){
  this.dataSource.sort = this.sort;
};
Run Code Online (Sandbox Code Playgroud)
<ng-container matColumnDef="name">
  <th mat-header-cell *matHeaderCellDef mat-sort-header> Resource </th>
  <td mat-cell *matCellDef="let element"> {{element.creator.name}} </td>
  <td mat-footer-cell *matFooterCellDef> </td>
</ng-container>
Run Code Online (Sandbox Code Playgroud)
displayedColumns: string[] = ['projectName', 'date', 'hours', 'description', 'name', 'location', 'Edit'];

@ViewChild(MatSort) sort: MatSort;

ngOnInit(){
  this.dataSource.sort = this.sort;
}
Run Code Online (Sandbox Code Playgroud)

typescript angular-material angular mat-table

0
推荐指数
2
解决办法
1202
查看次数