-
Notifications
You must be signed in to change notification settings - Fork 3.4k
feat: add support for Angular 21 #33004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
967be2c
bde8311
c579dd7
6943abe
8d18b26
5d5b79a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,20 @@ | ||
| import { Component } from '@angular/core' | ||
| import { Component, signal } from '@angular/core' | ||
| import { ChildProvidersService } from './child-providers.service' | ||
| import { take } from 'rxjs/operators' | ||
|
|
||
| @Component({ | ||
| selector: 'app-another-child', | ||
| standalone: false, | ||
| template: `<button (click)="handleClick()">{{ message }}</button>`, | ||
| template: `<button (click)="handleClick()">{{ message() }}</button>`, | ||
| providers: [ChildProvidersService], | ||
| }) | ||
| export class AnotherChildProvidersComponent { | ||
| message = 'default another child message' | ||
| message = signal('default another child message') | ||
|
|
||
| constructor (private readonly service: ChildProvidersService) {} | ||
|
|
||
| handleClick (): void { | ||
| this.service.getMessage().pipe( | ||
| take(1), | ||
| ).subscribe((message) => this.message = message) | ||
| async handleClick (): Promise<void> { | ||
| const message = await this.service.getMessage() | ||
|
|
||
| this.message.set(message) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,19 @@ | ||
| import { Component } from '@angular/core' | ||
| import { Component, signal } from '@angular/core' | ||
| import { ChildProvidersService } from './child-providers.service' | ||
| import { take } from 'rxjs/operators' | ||
|
|
||
| @Component({ | ||
| selector: 'app-child-providers', | ||
| standalone: false, | ||
| template: `<button (click)="handleClick()">{{ message }}</button>`, | ||
| template: `<button (click)="handleClick()">{{ message() }}</button>`, | ||
| }) | ||
| export class ChildProvidersComponent { | ||
| message = 'default message' | ||
| message = signal('default message') | ||
|
|
||
| constructor (private readonly service: ChildProvidersService) {} | ||
|
|
||
| handleClick (): void { | ||
| this.service.getMessage().pipe( | ||
| take(1), | ||
| ).subscribe((message) => this.message = message) | ||
| async handleClick (): Promise<void> { | ||
| const message = await this.service.getMessage() | ||
|
|
||
| this.message.set(message) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,11 @@ | ||
| import { Injectable } from '@angular/core' | ||
| import { HttpClient } from '@angular/common/http' | ||
| import { Observable } from 'rxjs' | ||
| import { map } from 'rxjs/operators' | ||
|
|
||
| @Injectable() | ||
| export class ChildProvidersService { | ||
| constructor (private readonly http: HttpClient) {} | ||
| async getMessage (): Promise<string> { | ||
| const response = await fetch('https://myfakeapiurl.com/api/message') | ||
| const data = await response.json() | ||
|
|
||
| getMessage (): Observable<string> { | ||
| return this.http.get<{ message: string }>('https://myfakeapiurl.com/api/message').pipe( | ||
| map((response) => response.message), | ||
| ) | ||
| return data.message | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,16 @@ | ||
| import { Component } from '@angular/core' | ||
| import { CounterService } from './counter.service' | ||
| import { Component, model } from '@angular/core' | ||
|
|
||
| @Component({ | ||
| selector: 'counter-component', | ||
| standalone: false, | ||
| template: `<button (click)="increment()"> | ||
| Increment: {{ count$ | async }} | ||
| Increment: {{ count() }} | ||
| </button>`, | ||
| }) | ||
| export class CounterComponent { | ||
| count$ | ||
|
|
||
| constructor (private counterService: CounterService) { | ||
| this.count$ = this.counterService.count$ | ||
| } | ||
| count = model<number>(0) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Incorrect use of model signal for internal stateThe |
||
|
|
||
| increment () { | ||
| this.counterService.increment() | ||
| this.count.set(this.count() + 1) | ||
| } | ||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.