I would like to ask you, how can I achieve this:
I have a component (lets name it FeatureComponent) with some box and inside this box three buttons. In another component (MainComponent) I'm using my FeatureComponent by selector tag . Now what I would like to do is to use selector tag from FeatureComponent like that:
<featurecomponent buttonOne="invisible" buttonTwo="disabled"></featurecomponent>
I've read about @Input & @Output and about directives, but I'm not sure if it's the right way.
Could someone advise me what I should use to achieve my goal?
EDIT:
Featurecomponent:
div class="group-radio-buttons">
<input type="radio"
value="1"
name="qaz"checked><small> buttonOne</small></div>
<input type="radio"
value="2"
name="qaz"><small> buttonTwo</small></div>
<input type="radio"
value="3"
name="qaz"><small> buttonThree</small></div>
</div>
And what I would like to achieve is to use this component in many other components but with possibility to manage this radio buttons like:
AnotherComponent:
<featurecomponent buttonOne="invisible" buttonTwo="disabled"></featurecomponent>
AnotherComponent2:
<featurecomponent buttonTwo="disabled"></featurecomponent>
@Input() buttonOne:string;to your components class you can access the value usingngOnInit() { console.log(this.buttonOne); }The input value won't be available in the constructor which is executed beforengOnInit. angular.io has a lot of great tutorials