
Daily hand-picked #angular resources. Open notification for informing firstly. 🔈
- Tweets131
- Following683
- Followers3.4K
- Likes263
![@Directive({ selector: "[ngSignalModel][ngModel]", exportAs: "ngSignalModel", providers: [ { provide: NgControl, useExisting: forwardRef(() => NgSignalModel) } ] }) export class NgSignalModel<T = any> implements OnChanges, OnInit { @Input("ngSignalModel") signal: SettableSignal<T>; #ngModel = inject(NgModel); ngOnInit() { this.#ngModel.valueAccessor.registerOnChange((value: T) => { this.signal.set(value); }); } ngOnChanges(changes: SimpleChanges) { const value = changes.signal.currentValue(); this.#ngModel.model = value; const model = new SimpleChange(undefined, value, true); this.#ngModel.ngOnChanges({ model }); } } @NgModule({ exports: [NgSignalModel, FormsModule], declarations: [NgSignalModel], imports: [FormsModule] }) export class SignalFormsModule {}](https://pbs.twimg.com/media/Fqx32zVWYAMuGUC.jpg?name=small&format=webp)
ALT @Directive({ selector: "[ngSignalModel][ngModel]", exportAs: "ngSignalModel", providers: [ { provide: NgControl, useExisting: forwardRef(() => NgSignalModel) } ] }) export class NgSignalModel<T = any> implements OnChanges, OnInit { @Input("ngSignalModel") signal: SettableSignal<T>; #ngModel = inject(NgModel); ngOnInit() { this.#ngModel.valueAccessor.registerOnChange((value: T) => { this.signal.set(value); }); } ngOnChanges(changes: SimpleChanges) { const value = changes.signal.currentValue(); this.#ngModel.model = value; const model = new SimpleChange(undefined, value, true); this.#ngModel.ngOnChanges({ model }); } } @NgModule({ exports: [NgSignalModel, FormsModule], declarations: [NgSignalModel], imports: [FormsModule] }) export class SignalFormsModule {}
![import { HttpClient, HttpContext, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { IS_JSON_PLACEHOLDER } from './http-contexts'; @Injectable({ providedIn: 'root', }) export class JsonPlaceholderClient extends HttpClient { override request( first: string | HttpRequest<any>, url?: string, options: RequestOptions = {} ): Observable<any> { if (typeof first === 'string') { this.#setPlaceholderContext(options); return super.request(first, url, options); } this.#setPlaceholderContext(first); return super.request(first); } #setPlaceholderContext(optionsOrRequest: { context?: HttpContext }) { optionsOrRequest.context ??= new HttpContext(); optionsOrRequest.context.set(IS_JSON_PLACEHOLDER, true); } } type RequestOptions = Parameters<HttpClient['request']>[2];](https://pbs.twimg.com/media/FmXDAxFagAAn6eG.jpg?name=small&format=webp)
ALT import { HttpClient, HttpContext, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { IS_JSON_PLACEHOLDER } from './http-contexts'; @Injectable({ providedIn: 'root', }) export class JsonPlaceholderClient extends HttpClient { override request( first: string | HttpRequest<any>, url?: string, options: RequestOptions = {} ): Observable<any> { if (typeof first === 'string') { this.#setPlaceholderContext(options); return super.request(first, url, options); } this.#setPlaceholderContext(first); return super.request(first); } #setPlaceholderContext(optionsOrRequest: { context?: HttpContext }) { optionsOrRequest.context ??= new HttpContext(); optionsOrRequest.context.set(IS_JSON_PLACEHOLDER, true); } } type RequestOptions = Parameters<HttpClient['request']>[2];

ALT import { HttpRequest, HttpHandlerFn } from '@angular/common/http'; import { IS_JSON_PLACEHOLDER } from './http-contexts'; export const interceptJsonPlaceholder = ( req: HttpRequest<unknown>, next: HttpHandlerFn ) => { if (!req.context.get(IS_JSON_PLACEHOLDER)) return next(req); const cloneReq = req.clone({ url: 'https://jsonplaceholder.typicode.com' + req.url, }); return next(cloneReq); };
![import { AsyncPipe, JsonPipe } from '@angular/common'; import { Component, inject } from '@angular/core'; import { JsonPlaceholderClient } from './json-placeholder.client'; @Component({ selector: 'app-root', standalone: true, imports: [AsyncPipe, JsonPipe], template: ` <div class="container p-3">{{ todo$ | async | json }}</div> `, }) export class AppComponent { todo$ = inject(JsonPlaceholderClient).get('/todos/1'); }](https://pbs.twimg.com/media/FmXDAw1aYAIsZof.jpg?name=small&format=webp)
ALT import { AsyncPipe, JsonPipe } from '@angular/common'; import { Component, inject } from '@angular/core'; import { JsonPlaceholderClient } from './json-placeholder.client'; @Component({ selector: 'app-root', standalone: true, imports: [AsyncPipe, JsonPipe], template: ` <div class="container p-3">{{ todo$ | async | json }}</div> `, }) export class AppComponent { todo$ = inject(JsonPlaceholderClient).get('/todos/1'); }
Improved Dev Tools
Code snippet showing improvements to stack traces in Angular v15 developed with Chrome DevTools.
Angular Error Code Improvements
Common errors in Angular will display a URL to angular.io with more information about the issue.










![<!-- mySignal is a signal --> <input [ngSignalModel]="mySignal" ngModel>](https://pbs.twimg.com/media/Fqx36_gWIAEkkHq.jpg?name=small&format=webp)















