So I infiltrate some HTML code into my app using this code:
fetchDashboard() { const requestOptions: Object = { headers: new HttpHeaders().append('Authorization', 'Bearer <tokenhere>'), responseType: 'text' } this.http.get<string>('http://localhost:3000/avior/dashboard', requestOptions) .subscribe(response => { // replace me with modification of component view console.log(response); } ); } I execute this code in my view with <a class="dropdown-item" (click)=fetchDashboard()>Dashboard</a>
For the optimal solution:
- How can I replace and append to a certain component's view (since the view consists of multiple components)?
Optional question:
- Is there a way to append directly to DOM? Since Angular doesn't properly use the DOM that doesn't sound like a viable solution to me and hence is optional.