0
同じテンプレート内の別の要素から(クリック)で要素のクラスを削除する方法を知っている人はいますか?角2他の要素のクラスを削除する(同じテンプレート)
をコンポーネントで:テンプレートで
public hideMeClassPresent = true;
:
<button (click)="hideMeClassPresent = false" class="mobile-only">
Show options
</button>
<div id="optionsDiv" [class.hideMe]="hideMeClassPresent">
...
</div>
基本角度原則です:あなたはDOM操作をしない結合
<button (click)="#options.classList.remove("hideMe")('hideMe')" class="mobile-only">
Show options
</button>
<div #options id="optionsDiv" class="hideMe">
...
</div>
'(クリック)= "options.classList.remove( 'hideMe')"'が、JB Nizetこのため – yurzui