Streamline your Angular development with Angular Signal Generators, a library of signals and utilities designed to replace common patterns for faster, cleaner code.
$id = signal(0); // call getCustomer every time $id changes. $customer = asyncSignal(() => this.$id() !== 0 ? this.getCustomer(this.$id()) : undefined);
$age = signal(21); $name = signal('Danny'); inspect({ age: $age, name: $name }); // [LOG]: { age: 21, name: 'Danny' } $age.set(102); // [LOG]: { age: 102, name: 'Danny' }
const liftedArray = liftSignal([1, 2, 3], null, ['push']); liftedArray.push(4) console.log(liftedArray()); // [1, 2, 3, 4];
$age = signal(21); $name = signal('Danny'); $nest = nestSignal({ age: $age, name: $name }); console.log($nest()); // [LOG]: { age: 21, name: 'Danny' }
Array.reduce
or Rxjs's scan
operator, using a reducer function to create a new value from the current and prior values. for async
loop.
const source = signal('start'); for await (const item of signalToIterator(source)) { console.log(item); // 'start', 'next' } source.next('next');