-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(angular): add HttpClient to the host app to demo the saving of t…
…he editing code text to API
- Loading branch information
Showing
6 changed files
with
48 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
<h2>Monaco Language Client Angular Client Two way data binding Example</h2> | ||
<div> | ||
@if(wrapperConfig) { | ||
<h2>Angular Monaco Editor demo with saving code to a mock HTTP server </h2> | ||
<div class="editor-container"> | ||
<monaco-angular-wrapper | ||
[wrapperConfig]="wrapperConfig" | ||
[wrapperConfig]="wrapperConfig()" | ||
[monacoEditorId]="editorId" | ||
[editorInlineStyle]="editorInlineStyle()" | ||
(onTextChanged)="onTextChanged($event)" | ||
></monaco-angular-wrapper> | ||
|
||
} | ||
|
||
{{ codeText() }} | ||
<button class="save-button" (click)="save()">Save</button> | ||
</div> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { inject, Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
@Injectable({ providedIn: 'root' }) | ||
export class SaveCodeService { | ||
private http = inject(HttpClient); | ||
saveCode(codeText: string) { | ||
return this.http.post('http://localhost:3003/save-code', { code: codeText }); | ||
} | ||
} |