-
-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(astro-angular): add support for render and client component prov…
…iders (#376)
- Loading branch information
1 parent
3af5ab3
commit bbfcb40
Showing
8 changed files
with
141 additions
and
14 deletions.
There are no files selected for viewing
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,36 @@ | ||
import { Component, OnInit, inject } from '@angular/core'; | ||
import { NgFor } from '@angular/common'; | ||
import { provideHttpClient, HttpClient } from '@angular/common/http'; | ||
|
||
interface Todo { | ||
id: number; | ||
title: string; | ||
completed: boolean; | ||
} | ||
|
||
@Component({ | ||
selector: 'app-todos', | ||
standalone: true, | ||
imports: [NgFor], | ||
template: ` | ||
<h2>Todos</h2> | ||
<ul> | ||
<li *ngFor="let todo of todos"> | ||
{{ todo.title }} | ||
</li> | ||
</ul> | ||
`, | ||
}) | ||
export class TodosComponent implements OnInit { | ||
static clientProviders = [provideHttpClient()]; | ||
|
||
http = inject(HttpClient); | ||
todos: Todo[] = []; | ||
|
||
ngOnInit() { | ||
this.http | ||
.get<Todo[]>('https://jsonplaceholder.typicode.com/todos') | ||
.subscribe((todos) => (this.todos = todos)); | ||
} | ||
} |
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
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