Skip to content

Additional Signals to improve developer experience.

Notifications You must be signed in to change notification settings

dszendrei/ngx-signals-plus

Repository files navigation

Ngx Signals Plus

Additional Signals to improve developer experience.

Usage

BindableSignal:

Originally designed as a replacement for Angular's toSignal, it can also be used to convert an Observable into a Signal. However, unlike toSignal, it supports lazy binding, can be unbound at any time, and can even be bound to other Signals. For more details, check out this article on Medium.

@Component({
  selector: "app-loader",
  standalone: true,
  imports: [],
  template: `
    @for (comp of subComponents(); track $index) {
    <div>...</div>
    }
  `,
})
export class LoaderComponent implements OnInit {
  readonly url = input.required<string>();

  private readonly httpClient = inject(HttpClient);

  readonly subComponents: BindableSignal<string[]> = bindable(["default sub component"]);

  ngOnInit(): void {
    this.subComponents.bindTo(this.httpClient.get<string[]>(this.url()));
  }
}

About

Additional Signals to improve developer experience.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published