Вы можете использовать @ViewChild
декоратор и после этого вы можете получить HTML со свойством externalHTML.Например:
app.component.html:
<div #someHTML>
<h1>Hello world</h1>
</div>
<button (click)="test()" >Test</button>
app.component.ts:
import { Component, ViewChild, ElementRef } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
})
export class AppComponent {
@ViewChild('someHTML') someHTML: ElementRef;
test(){
console.log(this.someHTML.nativeElement.outerHTML)
}
}
Теперь с помощью html вы можете отправить запрос на сервер.