I have a service in Angular 6 and I\'m trying to change a record but it\'s saying I\'m not authorized.
Right now I have this:
const httpOptions = {
httpClient passing basic auth in httpOptions is different in Angular 6
let httpHeaders= new HttpHeaders();
httpHeaders.append('Content-Type', 'application/json');
httpHeaders.append("Authorization", "Basic " + btoa("username:password"));
const httpOptions = {
headers: httpHeaders
};
update(id, title, content) {
const updateData = { id: id, title: title, content: content };
return this.http.put(`http://myurl/${id}`, updateData, httpOptions);
}