Angular router navigate method

preview_player
Показать описание
Text version of the video

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.

Slides

Angular 2 Tutorial playlist

Angular 2 Text articles and slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

In this video we will discuss the use of Angular Router service navigate() method. This method is useful when you want to navigate to another page programmatically.

Let us understand this with an example. Here is what we want to do. On the EmployeeComponent that displays specific employee details, we want to include a Button. When we click the button we want to redirect the user to EmployeeListComponent.

[div style="margin-top:5px"]
[input type="button" class="btn btn-primary" value="Back to Employees List"
(click)="onBackButtonClick()" /]
[/div]

Specify a dependency on the Router service using the EmployeeComponent class constructor. The angular injector will automatically inject an instance of the Router service when an instance of EmployeeComponent is created.
constructor(private _router: Router) {
}

onBackButtonClick() :void {
}
Рекомендации по теме
Комментарии
Автор

OMG! nice . Finally i understood this method thank you

karimgaber
Автор

Thank you! This is just what I needed!

taylorenglish
Автор

Suggestion: You should include the concept of relative routing as well.

the-gray-haired-developer
Автор

is that part of file upload going to be available soon?
my final year project is based totally on your coding style. you just know how to get straight to the point. thank you sir.

botsogorantutu
Автор

Thanks Sir, This cleared me everything!!!

ajeeteppakayala
Автор

How is the Router service injected in the employee component? We haven't specified it in the providers property of module/component.

naveen
Автор

how to do conditional routing, if we utilize a function in a button which redirects to the next page on click after comparing the credential in login page

saurabrakshit
Автор

I want to jump from one page to another page block, I am pasing block I'd to another page navigating to page but not to the block in that page.Can you tell me how to do this?? Thankyou inadvance.Please reply.

satyasubhashini
Автор

when I click back arrow bar in browser how to load the previous page exactly

rajeshnewtemp
Автор

Everything seems to work except when I click on EMP102 through EMP106. The employee details I get are for EMP101 only?

josephregallis
Автор

Hi sir, can you please tell me why the navigate method have parameters of array type?

parveenmangla
Автор

I wanted to navigate to a url with query params but I have a very long list of query params around 1000 params how to do so
using router.navigate method?

purveebajaj
Автор

Hi Sir ....please what is the difference between routing and navigation in angulu2... ?

NagaRaju-kqlu
Автор

does it have to be a service? not a component?

anacseq
Автор

Hi sir,
Tutorials are more helpful. We are having an html page which is using ng-template code which is opening a popup. with <ng-template

so we are trying to display data in this popup...but not displaying...
can you please help us how to display data in this popups with one example and one

Thanks in advance...

hymap
Автор

am getting the content in the component in same page, not in new page . why?

aishwaryam
Автор

Sir please upload a video for Shadow Dom and authorization

chetanpl
Автор

hi sir plz uplode form validation video

dipakranjansahoo
Автор

This is really good, but i need to see the ngOninit code

yusufbashir
Автор

sir plz uplode video from validation, and authogard video so soon pplz

dipakranjansahoo