Element have className property. This property contains all classes separated by space.
Markup
Observe below button. This button is having 3 classes btn, btn1, btn2. On click of this button we will show all classes of this button
<button class="btn btn1 btn2" (click)="getClassList($event)"> Get Class List </button>
Script - app.component.ts
Observe getClassList function which list down all classes of the element
import { Component } from '@angular/core'; @Component({ selector: 'my-app', template: ` <h2>Set Class List Of Element</h2> <div> <button class="btn btn1 btn2" (click)="getClassList($event)"> Get Class List </button> </div> <br/><br/> <div> <h3>{{classList}}</h3> </div> ` }) export class AppComponent { classList: string[] = []; getClassList($event) { this.classList = $event.target.className.split(/\s+/); for (let i = 0; i < this.classList.length; i++) { if (this.classList[i] === 'someClass') { //do something } } } }
I am very happy after visiting your website with very useful information. I am from one of the digital marketing agency... To visit my agency click on link Visitdigitalguru
ReplyDeleteคาสิโนออนไลน์ของดีลเลอร์สดนำเสนอวิดีโอสตรีมมิ่งกับดีลเลอร์ตัวhttps://happyluke-casino.net/จริงที่ซื้อขายไพ่จริงและเปิดตัวลูกบอลรูเล็ตของจริง โดยพื้นฐานแล้วมันใกล้เคียงที่สุดที่คุณจะได้รับออนไลน์กับประสบการณ์คาสิโนบนบกแบบดั้งเดิม
ReplyDeleteมีข้อดีมากกว่าข้อเสียของคาสิโนออนไลน์มากมาย สิ่งสำคัญที่สุดคือความสะดวกสบาย https://bk8casino.asia/ แทนที่จะต้องขับรถเป็นชั่วโมงเพื่อไปยังคาสิโนที่อยู่ใกล้บ้านคุณที่สุด ตอนนี้คุณสามารถใช้คาสิโนออนไลน์เพื่อดูออนไลน์และเล่นเกมแบล็คแจ็คได้ในไม่กี่นาที
ReplyDelete