Hi!
I’m trying to change button class on click but this is not that simple for me
static targets = ["bi-camera-video-off", "bi-camera-video-fill"]
static classes = ["bi-camera-video-off", "bi-camera-video-fill"]
videoSwitchBtn(event) {
if (this.publisher.getVideoSource().track) {
this.publisher.publishVideo(false);
this.bi-camera-video-offTarget.classList.remove(this.bi-camera-video-Class);
this.bi-camera-video-offTarget.classList.add(this.bi-camera-video-fillClass);
} else {
this.publisher.publishVideo(true);
this.bi-camera-video-offTarget.classList.add(this.bi-camera-video-fillClass);
this.bi-camera-video-offTarget.classList.remove(this.bi-camera-video-offClass);
}
}
In my html I have this
<button data-action="click->vonage#videoSwitchBtn" class="call-button">
<span data-target="vonage.bi-camera-video-off" class="icon-custom bi bi-camera-video-off"</span>
</button>
I have error
ReferenceError: camera is not defined
Any idea on why is not defined? Is that because bi-camera is conected by - ?