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?
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?
Share Improve this question asked Feb 7 at 13:34 Hubert KiszkaHubert Kiszka 192 bronze badges 1- Cannot reproduce with a simplified version of your code in StackBlitz. – JSON Derulo Commented Feb 7 at 13:38
1 Answer
Reset to default 0Make sure you imported the AuthComponentComponent
into the imports
array of the component that uses it.
@Component({
...
imports: [
...
AuthComponentComponent,
...
]
})
export class ComponentThatUsesAuth {
...