<ion-content>
<ion-button (click)="phoneEntryOpen()">Verify Your Phone</ion-button>
</ion-content>
In test page there is an ion-button, on click the button, verify-phone.component should appear where phone number will be entered. On click Send OTP button, verify-otp.component will be appeared and verify-phone.component will be disappeared.
When verify-otp.component is in sight, if user clicks on Change Phone Number button, verify-phone.component will appear.
Otherwise Clicking on Validate button, verify-otp.component should disappear.
Hope you can help me with this.
I’m noob in ionic and angular. But learning fast.
Maybe this is just me, but I’ve read this entire post ten times and still have virtually zero idea what it’s asking.
The headline speaks of “moving between two components”. Either that’s a transitive “moving”, — in which case what are you trying to move? – or an intransitive one, but in that case, what does it mean to “move” when you’re not changing pages?
The best questions generally include a clear description of:
the behavior you want
the behavior you have
the code that produces #2
a focus on the difference between #1 and #2 that is concerning you
You have presumably discovered that you can make parts of your template “appear” and “disappear” by using structural directives like *ngIf, and you’ve got a boolean in your page that gets toggled by a function that is wired to a button click. All of that looks like a very reasonable way to make components at least appear to “open” and “remove”.
So my question is: can you please describe what is irreparably different between what you have and what you want?
I suspect @Tommertom is referring to this post, but I’m actually not sure it’s appropriate here (but that’s probably because I still don’t really have a good grip on what the question is in this thread).
So I’ll fall back on some opinionated generalities, which is my stock in trade.
#1: If you aren’t certain why something is there, get rid of it. So absent some compelling reason to the contrary, good-bye <ng-content>. I can’t think of any reason it would be helpful in this situation.
#2: If something can’t stand on its own, and especially if it’s only used in one place, it shouldn’t be an independent component. So, in the final analysis, I’m not yet convinced that these two components should even exist, and if they don’t, perhaps whatever the problem is here will magically go away.
My first instinct would be to just write this as a single reactive form, with parts of the template either washed out to indicate “can’t interact with me at the moment” or selectively removed from the DOM entirely with *ngIf. I’m not seeing much potential value in overengineering this into a bunch of microcomponents.