Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 如何动态设置宽度&;角度2的高度_Angular_Angular5 - Fatal编程技术网

Angular 如何动态设置宽度&;角度2的高度

Angular 如何动态设置宽度&;角度2的高度,angular,angular5,Angular,Angular5,我已经创建了全局弹出组件。我想动态设置宽度和高度以及标题。怎么做? 模态: 样本标题1 接近 您可以使用装饰器来完成。将高度、宽度和标题模型传递给,如下所示: 现在在对话框中,component.html应该是: <div [@modal] *ngIf="visible" class="dialog" [ngStyle]="{'width': width+'px', 'height': height+'px'}"> <b>{{title}}</b>

我已经创建了全局弹出组件。我想动态设置宽度和高度以及标题。怎么做? 模态:


样本标题1
接近

您可以使用
装饰器来完成。将高度、宽度和标题模型传递给
,如下所示:

现在在
对话框中,component.html
应该是:

<div [@modal] *ngIf="visible" class="dialog" [ngStyle]="{'width': width+'px', 'height': height+'px'}">
    <b>{{title}}</b>
    <ng-content></ng-content>
    <button *ngIf="closable" (click)="close()" aria-label="Close" class="cls">X</button>
</div>
<div *ngIf="visible" class="overlay" (click)="close()"></div>

{{title}}
X

工作正常..谢谢SSANOJ..我还有一个问题?@AppleRange是的,你能分享吗?Sanoj:我们如何创建自己的jshint?Sanoj:从你的示例链接中,我们如何为open和close编写代码(用typescript)。在我点击按钮后,我想打开特定的弹出窗口。怎么做?
<div [@modal] *ngIf="visible" class="dialog" [ngStyle]="{'width': width+'px', 'height': height+'px'}">
    <b>{{title}}</b>
    <ng-content></ng-content>
    <button *ngIf="closable" (click)="close()" aria-label="Close" class="cls">X</button>
</div>
<div *ngIf="visible" class="overlay" (click)="close()"></div>