Bird
0
0

In Angular SPA, what is the effect of clicking a link with <a href='/contact'>Contact</a> without routing?

medium📝 Predict Output Q5 of 15
Angular - Routing
In Angular SPA, what is the effect of clicking a link with <a href='/contact'>Contact</a> without routing?
AAngular intercepts and loads ContactComponent without reload
BThe browser reloads the page and navigates to /contact
CNothing happens because href is ignored
DAn error occurs due to missing route
Step-by-Step Solution
Solution:
  1. Step 1: Understand default anchor behavior

    Without routing, clicking an anchor with href reloads the page to that URL.
  2. Step 2: Role of Angular routing

    Angular routing intercepts clicks on routerLink, not plain href, to prevent reload.
  3. Final Answer:

    The browser reloads the page and navigates to /contact -> Option B
  4. Quick Check:

    Plain href causes reload = True [OK]
Quick Trick: Use routerLink to avoid reload on navigation [OK]
Common Mistakes:
MISTAKES
  • Assuming Angular intercepts plain href clicks
  • Thinking href is ignored
  • Believing missing route causes error immediately

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes