Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

247
Vistas
Redirect to new page by replacing the current page

My goal: user is in the welcome page(app component html) and when clicked on button, he should be able to go to another html page. I checked the tutorials and know that i should use routes to do this but whatever I do, i couldn't get this simple thing working with the following code, I click on the button url changes but i cant see the inner content html of hizmetlerimiz file:

App Component Html File:

<app-header></app-header>
<button routerLink="/hizmetlerimiz">click me</button>
<app-footer></app-footer>

App-routing-module.ts file:

const routes: Routes = [
  {
    path: 'hizmetlerimiz',
    component: HizmetlerimizComponent,
  },
  {
    path: '',
    component: AppComponent,
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Hizmetlerimiz Component:

import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'hizmetlerimiz',
  templateUrl: './hizmetlerimiz.component.html',
  styleUrls: ['./hizmetlerimiz.component.css']
})

export class HizmetlerimizComponent implements OnInit {

  constructor() { }

  ngOnInit(): void {
  }

}

Hitmetlerimiz Component Html File

<h5>hizmetlerimiz</h5>
<p>some hizmets</p>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You need to utilize <router-outlet></router-outlet>. This tag is a placeholder for the html content and is filled with the component attached to the current route

So it should look something like this:

<app-header></app-header>
<router-outlet></router-outlet>
<button routerLink="/hizmetlerimiz">click me</button>
<app-footer></app-footer>

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda