Interview Questions

1. Can you demonstrate navigation between different routes in an Angular application?

You can demonstrate the navigation between different routes in an Angular app in the following way. See the following code to demonstrate navigation in an Angular app named "My First App."

import from "@angular/router";  





  selector: 'app-header',  

  template: `  

<nav class="navbar navbar-light bg-faded">  

  <a class="navbar-brand" (click)="goHome()">My First App</a>   

  <ul class="nav navbar-nav">  

    <li class="nav-item">  

      <a class="nav-link" (click)="goHome()">Home</a>   


    <li class="nav-item">  

      <a class="nav-link" (click)="goSearch()">Search</a>   





class HeaderComponent {  

  constructor(private router: Router) {}   

  goHome() {  



  goSearch() {  




By Md Riyazuddin 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started


Leave a Comment

Check out more interview questions

Based on your skills

MS SQL Server

1433426 1720 18 859


35904 92 0 46


28192 72 1 36