小编use*_*092的帖子

如何在打字稿/角度中设置 html 元素的样式

我正在尝试将属性设置为 html 元素,但收到错误类型“HTMLCollectionOf”不可分配给类型“HTMLElement”

这是我的打字稿代码---

let elem: HTMLElement= document.getElementsByClassName('notification-top-bar');
      setTimeout(elem.setAttribute("style", "display:none;"), this.duration);
Run Code Online (Sandbox Code Playgroud)

这是我的 HTML 代码---

<div class="row">
  <div *ngFor="let n of notifications" class="notification-top-bar" [ngClass]="type" style="display: block;">
    {{message}}  
    <a class="close glyphicon glyphicon-close" (click)="onCloseNotifications($event)"></a>
    <p>{{n}}</p>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

如何使字体真棒图标按钮处于禁用状态?

我正在使用超棒的字体图标按钮,我需要使图标处于禁用状态。我可以使用Bootstrap禁用类使它看起来像禁用按钮,但是它是可单击的。有什么办法可以使非点击?

这是我的HTML代码:-

<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<button class='btn btn-primary disabled' disabled>
  <i class="fa fa-search"></i>
</button>
Run Code Online (Sandbox Code Playgroud)

html css font-awesome bootstrap-4

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

标签 统计

angular ×1

bootstrap-4 ×1

css ×1

font-awesome ×1

html ×1

typescript ×1