LoginSignup
0
0

More than 5 years have passed since last update.

Angular イベントバインディングの処理内でのカスタム属性アクセス方法メモ

Posted at

イベントバインディング処理内でのカスタム属性(data-*)へのアクセス方法
target.dataset内に格納されるので以下でアクセス

sample.component.html
<a data-xxx="カスタムデータ" (click)="onClick($event)">sample</a>
sample.component.ts
onClick(event) {
  console.log(event.target.dataset.xxx);
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0