I am working on a small web game using Angular 6. I have 2 relevant components, play.component and setup.component. The idea is that the user can choose things like difficulty in the setup-component and the user input changes the innerHTML of the elements in the play component. However I don't manage to come up with a way to save the user input in the setup component and access it afterwards from the play component.
I spent some time now looking for my problem and couldn't find anything. If you have alternatives to my solution, please tell me :)
Thanks
Code below
<div id="dropdown">
<p-dropdown [options]="ai" [(ngModel)]="selectedAi" optionLabel="difficulty">
</p-dropdown>
</div>
<div id="check">
<p>Do you want to start? <p-checkbox [(ngModel)]="begin" binary="true">
</p-checkbox>
</p>
</div>
I want to access the variables selectedAI and begin from another component. How do I do it?