All Questions
Tagged with angular18 angular-signals
8
questions
2
votes
3
answers
177
views
Angular: difference between using signal and simple class member for holding state [closed]
I am using signals in Angular 18 for small local states. I don't understand what the difference is with a normal class member. Let's take a simple toggle:
Example 1
@Component({...})
export class ...
1
vote
3
answers
120
views
How to bind an Angular signal/model to a template-driven <input> with an object as a value?
I'm trying to implement two-way binding in Angular18 by binding a property of an object within a signal (model) to ngModel. Specifically, I want to use a model signal as the source and ensure that ...
1
vote
2
answers
63
views
In Angular 17+, how to pass signal<number | undefined> to a child component input signal<number>?
Say I have two parent & child components respectively:
Parent Component:
@Component({
selector: 'app-parent',
template: `<app-child [id]="id()"></app-child>`, // this gives ...
0
votes
0
answers
135
views
Compute signal throwing error about derived signal is not a function
I am using Angular version 18.1.0 in a hybrid app mode environment (AngularJS + Angular 18)
I have the following code that take in input signal and compute a signal dependent on the input signal.
My ...
1
vote
2
answers
101
views
Angular AuthGuard Not Blocking Access When Directly Navigating to blocked Routes
I'm working on an Angular application where I want to prevent authenticated users from accessing the login and signup pages. I have implemented an AuthGuard to handle this. The guard works as expected ...
1
vote
1
answer
266
views
Serialising a model with signals in Angular 18
I'm trying to serialise a model object to local storage (or IndexedDB), however it contains signals.
// An example of the model I'm dealing with
export class ExampleModel {
canSerialise = "&...
1
vote
2
answers
139
views
Union types don't work in Angular ModelSignal<T> generic type
In Angular 18.1 I have the following code:
public unit = model('px');
And it works correctly, indeed if I inspect the type I get:
ModelSignal<string>
I want to provide a better type definition ...
0
votes
1
answer
2k
views
How to emit a click event with Angular 18 output api
I have a button component that receives some inputs and when is clicked I want to emit the fact that it's been clicked using the new output api.
This is button.component.html
<button (click)="...