I am encountering an issue while attempting to use setAttribute() within toggleDiv(). My IDE does not seem to recognize the function and is throwing an error. How can I resolve this problem so that the function is recognized? This specific case relates to an Angular project.
import { Component, OnInit } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {ActivatedRoute} from '@angular/router';
import {Observable} from 'rxjs';
@Component({
selector: 'app-cocktails',
templateUrl: './cocktails.component.html',
styleUrls: ['./cocktails.component.css']
})
export class CocktailsComponent implements OnInit {
apiData = 'https://www.thecocktaildb.com/api/json/v2/my_key/popular.php';
cocktailList: any;
constructor(private httpClient: HttpClient, private route: ActivatedRoute) { }
ngOnInit(): void {
this.getApiData().subscribe((cocktails) => {
this.cocktailList = cocktails.drinks;
console.log(cocktails);
});
}
getApiData(): Observable<any> {
console.log(this.apiData);
return this.httpClient.get(this.apiData);
}
toggleDiv(): void {
document.querySelectorAll('div.col-md-3').setAttribute()
}
}