小编lan*_*all的帖子

Angular 7+:将静态 html 文件注入组件视图中间

我无法找到将文件中的静态 html 注入视图中间的最佳方法。我有一个名为 eula-dialog 的组件,其中该组件尚未执行任何操作,但视图如下所示:eula-dialog.component.html

<h1 md-dialog-title>Sign EULA</h1>
<mat-dialog-content>

  <!-- HOW TO INJECT A FILE HERE -->
  <div> REPLACE ME WITH CONTENTS OF FILE</div>


</mat-dialog-content>
<mat-dialog-actions>
  <mat-checkbox [(ngModel)]="agreeCheckbox">I have read and agree to the eula</mat-checkbox>
  <button md-raised-button color="primary" mat-dialog-close [disabled]="!agreeCheckbox">
    I Agree
  </button>
</mat-dialog-actions>
Run Code Online (Sandbox Code Playgroud)

我有一个如下所示的文件夹结构:

eula-dialog
    eula-dialog.component.html
    eula-dialog.component.scss
    eula-dialog.component.spec.ts
    eula-dialog.component.ts
    very-long-readonly-eula-template.html
Run Code Online (Sandbox Code Playgroud)

我无法修改 eula HTML 的内容,它主要包含文本和一些 html 元素,但不是完整的页面,它看起来像这样:

<p>Title</p>
<div> LOTS OF TEXT </div>
Run Code Online (Sandbox Code Playgroud)

最好的方法是什么?此外,最好不要始终随应用程序加载此 eula html 文件/模板,而仅在需要时发送到客户端。

html angular-material angular

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

automapper将深层对象自动化为扁平对象和后退

如何使用automapper将深对象转换为平面对象并返回?

例如:

Person 
{
    public string Name { get; set; }
    public Address Address { get; set; }
}

Address
{
    public string City { get; set; }
    public string State { get; set; }
}

FlatObject
{
    public string Name { get; set; }
    public string City { get; set; }
    public string State { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

c# automapper

2
推荐指数
1
解决办法
2882
查看次数

打字稿 - 返回一个空数组而不声明局部变量

我有一段看起来像这样的代码:

let emptyArray: string[]
    if (context == null) 
        return emptyArray
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点:

    if (context == null) 
        return new string[]
Run Code Online (Sandbox Code Playgroud)

typescript

2
推荐指数
1
解决办法
7214
查看次数

标签 统计

angular ×1

angular-material ×1

automapper ×1

c# ×1

html ×1

typescript ×1