i'm beginner in Vue and i need to get button id which i set it like the code below:
<li v-for="subject in this.$root.$data.LoggedUserSubjects">
<button :style="btnStyleObject" :id="subject.subject.id" @click="showSessions(this.id)" class="btn btn-primary">{{subject.subject.name}}</button>
</li>
as you can see i need to pass the id to showSessions function but i get this error when i click the button
Cannot read property 'id' of null
how can i get the id
thanks a lot
this.id? change that tosubject.subject.id.