i have been trying to navigate to different pages using angular 2. it navigates but the content of the previous page also gets displayed. Please help me out. Screenshot
In the image, when i click on sign up button, i get the text register, but i want the buttons to go and only the text "register" to appear.
app.component.html-
<div class='col-md-4'>
<button type=button class="btn btn-lg btn-primary" (click)="onClick1();">Sign In</button>
<button type=button class="btn btn-lg btn-default" (click)="onClick2();">Sign Up</button>
</div>
<div class="outer-outlet">
<router-outlet></router-outlet>
</div>
</div>
app.routes.ts-
import { Routes} from '@angular/router';
import { SignInComponent } from './SignIn/signin.component';
import { SignUpComponent } from './SignUp/signup.component';
export const routes: Routes = [
{ path: '', redirectTo: 'signUp', pathMatch: 'full' },
{ path: 'signIn', component: SignInComponent },
{ path: 'signUp', component: SignUpComponent }];
main.ts-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import { RouterModule} from '@angular/router';
import { SignInComponent } from './SignIn/signin.component';
import { SignUpComponent } from './SignUp/signup.component';
import { routes } from './app.routes';
@NgModule({
imports: [ BrowserModule, FormsModule, RouterModule.forRoot(routes)],
declarations: [ AppComponent, SignInComponent, SignUpComponent],
bootstrap: [ AppComponent ]
})
class AppModule {}
platformBrowserDynamic().bootstrapModule(AppModule);