Is it possible in angular to switch between two components without the need for routes? if there is how do i go about that please? I want to be switching between just two components and i don't want to use routes for that.
            Asked
            
        
        
            Active
            
        
            Viewed 2,438 times
        
    1 Answers
4
            <component1 *ngIf="page == 1"></component1>
<component2 *ngIf="page == 2"></component2>
Where page is a field on the host component where you assign 1 or 2 to switch between the pages. You can also use ngSwitchWhen 
See also Angular 2 dynamic tabs with user-click chosen components for a different approach.
 
    
    
        Community
        
- 1
- 1
 
    
    
        Günter Zöchbauer
        
- 623,577
- 216
- 2,003
- 1,567