How do you create a link in your template that navigates to a different route in Angular?
- Using the tag with an href attribute.
- Using the router-link directive.
- Using the navigateTo function.
- Using the ng-route module.
In Angular, you create a link in your template that navigates to a different route using the router-link directive. This directive is specifically designed for routing and allows you to define the target route as an attribute. The other options, such as using an tag with href, a navigateTo function, or the ng-route module, are not standard ways to handle routing in Angular and may not work as expected.
Loading...
Related Quiz
- You are tasked with creating a directive that changes the background color of an element when it's hovered over. Which type of directive would be best suited for this task?
- When you want to add a specific Angular capability to your project (like PWA support), you would use the ng ________ command.
- What is the primary purpose of services in Angular?
- The NG_VALUE_ACCESSOR token is used to provide the ________ for a custom form control.
- You have a requirement to dynamically load a component at runtime based on user actions. Which tools or concepts in Angular would you utilize to accomplish this?