Angular Tutorial - 27 - Optional Route Parameters

  Рет қаралды 181,621

Codevolution

Codevolution

Күн бұрын

Пікірлер: 45
@CodingByAmp
@CodingByAmp 4 жыл бұрын
the best of legend teaching angular .
@atharvasuryawanshi
@atharvasuryawanshi Жыл бұрын
Thank you for the Series. Great Videos!
@josemariacostateixeira6133
@josemariacostateixeira6133 4 жыл бұрын
You are an excellent teacher!
@MG-bm5oj
@MG-bm5oj 6 жыл бұрын
Great videos! Just one question about this one. It doesn't seem a good practice to pass parameter back like shown in the video as the URL should be cleaned for SEO reasons so I wonder if there is another way to do it. Thanks for your time!
@0GRANATE0
@0GRANATE0 6 жыл бұрын
Angular + SEO = horror
@tharindu79
@tharindu79 5 жыл бұрын
Why would you do a null check then assign null when it's null anyway?
@nasrihaithem9529
@nasrihaithem9529 4 жыл бұрын
was going to ask same question lol
@sabaoonullahn4819
@sabaoonullahn4819 3 жыл бұрын
@@nasrihaithem9529 I think that's because you can go with next to more than the ids that we have in the department list.
@iyakfishing2917
@iyakfishing2917 6 жыл бұрын
Great info!! Full of great practices!! But I've been using the routerLink to navigate back in pages which works fine, and easy but is this not good practice?
@chhotiBacchiNamHai
@chhotiBacchiNamHai 4 жыл бұрын
I did this but the color did not change. Don't understand what is wrong with the code.
@devenshah3653
@devenshah3653 3 жыл бұрын
same here but no help from Vishwas !
@adnankhuwaja1234
@adnankhuwaja1234 3 жыл бұрын
same issue
@lorem349
@lorem349 3 жыл бұрын
Exactly having the same issue
@ragahavavani3663
@ragahavavani3663 2 жыл бұрын
Same problem
@shaiknayeemuddinjaffree1303
@shaiknayeemuddinjaffree1303 2 жыл бұрын
same issue..color didn't change😢
@another-day-2024
@another-day-2024 4 жыл бұрын
@Codevolution : how to hide the optional parameters from url i.e. It does not look great to have ';id' in the URL.
@juanjoseramirezcalderon2618
@juanjoseramirezcalderon2618 5 жыл бұрын
Hi, I'm very new to Angular. Why are the URL params separated by a semicolon ( .../departments;id=2;test=testvalue ) ? I would expect it to be separated with commas and after a question mark (.../departments?id=2,test=testvalue). Is that the Angular way or something like that? Does it make a difference? Is it possible to use the question mark syntax way in the URL with Angular? I think there's something called , why is it not used here?
@sajansjoseph
@sajansjoseph 5 жыл бұрын
First of all, its not comma, its & symbol used in normal URL (For server side languages)... Angular is not server side framework... all url requests are parsed and translated by local javascript engine. Hence Angular can accept anything in the URLs... Anyhow, semicolon is valid in URL...
@abhig3871
@abhig3871 6 жыл бұрын
Thank you for the Series.
@ashwingowda2604
@ashwingowda2604 4 жыл бұрын
If I click on next when I'm inside /departments/5, it will open departments/6 detail page. How to avoid that?
@garapatigokulsairam5889
@garapatigokulsairam5889 2 жыл бұрын
add if condition and navigate to 404 error view or to home view. let id = this.deptId + 1; if(id >5) this.router.navigate(['']); else this.router.navigate([/'departments',id]);
@fabiotchezaum
@fabiotchezaum 6 жыл бұрын
So let me see if I understood: If you pass only the parameter it goes like mandatory; if you pass an object as parameter it goes as optional; Is it correct?
@idlevandal69
@idlevandal69 5 жыл бұрын
Hi Fabio, you probably have your answer by now but just in case someone else sees your question, the second parameter is of type NavigationExtras. If you go to the Angular docs and search for NavigationExtras you will see that there many different options you can pass as the second parameter to router.navigate().
@AnandAKGupta
@AnandAKGupta 6 жыл бұрын
Hi, what is the preferred method to remove such Optional Route Parameters from the URL (individually)... for instance say if I use Relative Navigation from the next component (then these params still stay in the URL) I can manipulate the URL string and use router.navigateByUrl() instead of relative but that seems like dirty code. Any idea?
@priyanth123mohan
@priyanth123mohan 6 жыл бұрын
hi vishwas I didn't get this point this.departmentId ? this.departmentId : null (1:50) can u pls expalin
@Codevolution
@Codevolution 6 жыл бұрын
Hi Priyanth, It is a ternary operator. If departmentId has a value, that is assigned to selectedId. If there is no value, null is assigned to selectedId. For more info - developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator
@JuanCamiloCampoT95
@JuanCamiloCampoT95 6 жыл бұрын
thank you, I had the same question. nice videos
@nasrihaithem9529
@nasrihaithem9529 4 жыл бұрын
@@Codevolution if its not null then return departmentId ,else return null ?
@nasrihaithem9529
@nasrihaithem9529 4 жыл бұрын
sorry i diidnt understand the semantic of it , if i assign departmentId to selectedId, the selectedId gonna be null if departmentId is ,else its gonna have the departmentId value !! i dont need a ternary operator here! it gonna be automatic no ?
@sahilumredkar
@sahilumredkar 4 жыл бұрын
When I click on back button id is showing in url it is right but it showing page not found what is solutions for that
@OtakuBuzz-N
@OtakuBuzz-N 4 жыл бұрын
At first u see what u have written the route for the department listComponent and then on the gotoDepartments in native write if u have written same to same as shown in video u have to write department if not check once
@sonamohialdin3376
@sonamohialdin3376 2 жыл бұрын
So good tutorial thank you
@DOHandDOH
@DOHandDOH 4 жыл бұрын
Shouldn't the query parameters be separated using a question mark? The semicolon is part of 1994 spec, which is now obsolete and the semicolon notation is technically illegal.
@warek-bs5hs
@warek-bs5hs 3 жыл бұрын
These are optional parameters, not query. Though in such case using query is better and more clear
@Jovialguy110
@Jovialguy110 2 жыл бұрын
My doubt is why not use event emitting from child to parent class?
@OtakuBuzz-N
@OtakuBuzz-N 4 жыл бұрын
Hi I it's returning to page not found What should I do
@msh1996
@msh1996 5 жыл бұрын
Great Videos
@Vikashkumar-vt9hl
@Vikashkumar-vt9hl 4 жыл бұрын
Binding method to a property is not good practice. Instead you can bind a boolean property and updated it under the routeMap subscription.
@Krazness
@Krazness 4 жыл бұрын
Can you explain why this is the better practice?
@dhome111
@dhome111 4 жыл бұрын
(click) it's doesn't work with me i'm using angular 9 can any one help me
@seenuvasanv
@seenuvasanv 6 жыл бұрын
Thanks.
@hatemalhasani
@hatemalhasani 5 жыл бұрын
Angular has two ways to pass parameters in url 1. router param almost part of route. e.g "/segment/1" // 1 is the id parameter. 2. queryParams optional parameter. e.g "/segment?id=1. in this video [2.55] there is none compiled error line 43 it should be this.router.navigate(['/departments'], { queryParams: { id: 1 } });
@xinaxtle9825
@xinaxtle9825 4 жыл бұрын
gracias por los parametros opcionales
Angular Tutorial - 28 - Relative Navigation
6:11
Codevolution
Рет қаралды 158 М.
Angular Tutorial - 25 - Route Parameters
9:56
Codevolution
Рет қаралды 379 М.
IL'HAN - Qalqam | Official Music Video
03:17
Ilhan Ihsanov
Рет қаралды 700 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Passing Query Parameters to Route | Angular Route | Angular 13+
20:37
Angular required route parameter vs optional route parameter
7:21
Use @Input to Read Angular Route Parameters
9:24
Deborah Kurata
Рет қаралды 12 М.
Angular Tutorial - 26 - paramMap Observable
6:37
Codevolution
Рет қаралды 226 М.
Angular Tutorial - 24 - Wildcard Route and Redirecting Routes
7:31
Codevolution
Рет қаралды 285 М.
Angular Forms Tutorial - 7 - Tracking state and validity
8:59
Codevolution
Рет қаралды 179 М.
Route Parameters - Angular (Tutorial #21)
14:40
Nisha Singla
Рет қаралды 34 М.
Angular v19 Developer Event
22:54
Angular
Рет қаралды 70 М.
Domain-Driven Design: The Last Explanation You'll Ever Need
21:05
Software Developer Diaries
Рет қаралды 14 М.