1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Why is value of @Input() null in Angular?

Discussão em 'Angular' iniciado por Rich, Julho 2, 2025.

  1. Rich

    Rich Guest

    I have an Input variable in my component that looks like this:

    @Input() Id: string;


    In my template, I'm displaying the Id and it has a value:

    Id == {{ Id }}


    But in the ngOnInit in the TypeScript when I try to print the Id, it's null

    ngOnInit(): void {
    console.log('Id=' + this.Id);


    What am I doing wrong? Am I trying to access it too early? Is there something I can do in order to get the actual value in the ngOnInit() ?

    Continue reading...

Compartilhe esta Página