Relative Content

Tag Archive for angulartypescript

Wait for a response before loading template

I have an angular application that makes a server call on ngOnInit() and returns a result. I then use the result to populate a model in my template. My template is loading before the call is finished, giving me an undefined error. How can I ensure the call has completed before the template loads?

Forward input value with same type

I’m trying to forward an input of a (external) component – this input is of type string | undefined.
But when i define my own input with the exact same type, i get an error that the types are incompatible

Explicit undefined properties after Angular migration

We recently migrated multiple Angular 16 projects into a single NX mono repo using Angular 17.
Everything works fine, BUT there is a strange behavior on our models. before the migration, properties that were no set were just no shown at all… while now, they are explicitly set as “undefined”. And this can sometimes create problems while calling HTTP API as they interpret this “undefined” as a value…

How to use service in Angular ngModule

Here is a shared module and I want to use translate service inside module but the problem here is that setCulture(translate.currentLang); the translate here is unknown.

Angular async pipe with @for

I am using latest angular version 18.1.0 and want to use async pipe for an array of countries fetched from the backend using http client. But while using new angular feature of @for it give me error: