How to pass variable into component properites in Angular

Discussão em 'Angular' iniciado por Hubert Kiszka, Fevereiro 7, 2025.

  1. So i have such main component

    <div class="wrapper">
    // some code here
    @if (isLogin()){
    // some code if isLogin is true
    }
    </div>


    in my component.ts i have declared it as InputSignal set to false

    export class AuthComponentComponent implements OnInit{
    title= input.required<string>();
    buttonText = input.required<string>();
    linkText = input.required<string>();
    linkUrl = input.required<string>();
    isLogin = input<boolean>(false);
    // ...
    }


    Then i create components based on this like so

    <app-auth-component
    title="Zaloguj się"
    buttonText="Zaloguj się"
    linkText="Lub utwórz nowe konto!"
    linkUrl="/register">
    (formSubmit)="handleLogin($event)">
    </app-auth-component>



    at first i tried to just add

    <app-auth-component
    //...
    [isLogin]="true"
    </app-auth-component>



    but it does not work, it does not change the value of isLogin with creation of component. Any ideas?

    Continue reading...

Compartilhe esta Página