Angular Tutorial - 27 - Optional Route Parameters

  Рет қаралды 182,178

Codevolution

Codevolution

Күн бұрын

Пікірлер: 45
@CodingByAmp
@CodingByAmp 4 жыл бұрын
the best of legend teaching angular .
@josemariacostateixeira6133
@josemariacostateixeira6133 4 жыл бұрын
You are an excellent teacher!
@atharvasuryawanshi
@atharvasuryawanshi Жыл бұрын
Thank you for the Series. Great Videos!
@abhig3871
@abhig3871 7 жыл бұрын
Thank you for the Series.
@sonamohialdin3376
@sonamohialdin3376 2 жыл бұрын
So good tutorial thank you
@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?
@msh1996
@msh1996 5 жыл бұрын
Great Videos
@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
@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 6 жыл бұрын
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...
@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.
@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().
@seenuvasanv
@seenuvasanv 7 жыл бұрын
Thanks.
@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?
@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]);
@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😢
@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 ?
@xinaxtle9825
@xinaxtle9825 4 жыл бұрын
gracias por los parametros opcionales
@OtakuBuzz-N
@OtakuBuzz-N 4 жыл бұрын
Hi I it's returning to page not found What should I do
@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?
@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?
@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
@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 } });
@dhome111
@dhome111 4 жыл бұрын
(click) it's doesn't work with me i'm using angular 9 can any one help me
Angular Tutorial - 28 - Relative Navigation
6:11
Codevolution
Рет қаралды 158 М.
Angular Tutorial - 25 - Route Parameters
9:56
Codevolution
Рет қаралды 380 М.
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Use @Input to Read Angular Route Parameters
9:24
Deborah Kurata
Рет қаралды 12 М.
Passing Parameters to Route | Angular Routing | Angular 13+
13:28
Angular Tutorial - 26 - paramMap Observable
6:37
Codevolution
Рет қаралды 226 М.
Angular 18 Reactive Forms CRUD - Ultimate Guide for Beginners
24:17
Learn Smart Coding
Рет қаралды 2,8 М.
10 Signs Your Software Project Is Heading For FAILURE
17:59
Continuous Delivery
Рет қаралды 45 М.
MASTER Angular in 90 Minutes with This Crash Course
1:29:09
Code with Ahsan
Рет қаралды 95 М.
Passing Query Parameters to Route | Angular Route | Angular 13+
20:37
Route Parameters - Angular (Tutorial #21)
14:40
Nisha Singla
Рет қаралды 34 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,8 МЛН
36. Using Route Parameters in Angular
10:40
Ervis Trupja
Рет қаралды 904
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН