Тёмный
No video :(

Angular query params 

kudvenkat
Подписаться 832 тыс.
Просмотров 51 тыс.
50% 1

In this video we will discuss Query String Parameters in Angular. Creating and reading Query String Parameters is somewhat similar to creating and reading required and optional route parameters. We discussed required and optional route parameters in Parts 43 and 44 of Angular CRUD tutorial.
Healthy diet is very important for both body and mind. We want to inspire you to cook and eat healthy. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking.
/ @aarvikitchen5572
Text version of the video
csharp-video-tu...
Slides
csharp-video-tu...
Angular CRUD Tutorial
• Angular CRUD tutorial
Angular CRUD Tutorial Text Articles & Slides
csharp-video-tu...
All Dot Net and SQL Server Tutorials in English
www.youtube.co...
All Dot Net and SQL Server Tutorials in Arabic
/ kudvenkatarabic
Query parameters are usually used when you want the parameters on the route to be optional and when you want to retain those parameters across multiple routes. For example, on the LIST route, you search for a specific employee. You then click on one of the employees in the search results to view that specific employee details on the DETAILS route. At this point, when we navigate back to the LIST route we want to retain the search term used, so we can display the filtered list instead of the full employee list.
Just like optional route parameters, query parameters are not part of the route configuration and therefore they are not used in route pattern matching.
Passing query string parameters in code : We use the second argument of the Router service navigate() method to pass query string parameters.
1. Create an object with queryParams as the key.
2. The value is an object with key/value pairs.
3. The key is the name of the query parameter and the value is the value for the query parameter.
this._router.navigate(['employees', employeeId], {
queryParams: { 'searchTerm': this.searchTerm, 'testParam': 'testValue' }
});
The query string parameters start with a question mark and are separated by & as you can see below.
localhost:4200/employees/3?searchTerm=John&testParam=testValue
Passing query string parameters in the HTML
[a [routerLink]="['/employees']"
[queryParams]="{ 'searchTerm': 'john', 'testParam': 'testValue'}"]
List
[/a]
Preserve or Merge Query String Parameters : By default, the query string parameters are not preserved or merged when navigating to a different route. To preserve or merge Query Params set queryParamsHandling to either preserve or merge respectively.
Preserve query string parameters in code
this._router.navigate(['/employees', this._id], {
queryParamsHandling: 'preserve'
});
Please note : queryParamsHandling is available in Angular 4 and later versions. If you are using Angular 2, you would not have queryParamsHandling. You will have to use preserveQueryParams and set it to true. preserveQueryParams is deprecated since Angular 4.
Merge query string parameters in code :
this._router.navigate(['/employees', this._id], {
queryParams: { 'newParam': 'newValue' },
queryParamsHandling: 'merge'
});
Preserve query string parameters in the HTML :
[a [routerLink]="['/list']"
queryParamsHandling="preserve"]
Back to List
[/a]
Merge query string parameters in the HTML :
[a [routerLink]="['/list']"
[queryParams]="{'newParam': 'newValue'}" queryParamsHandling="merge"]
Back to List
[/a]
Next Video : How to read query params.

Опубликовано:

 

26 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 14   
@tapasbehura1521
@tapasbehura1521 6 лет назад
Thank you sir... For you I got first my first job.
@semikolon4229
@semikolon4229 6 лет назад
Congratulations!
@gaganmankar246
@gaganmankar246 5 лет назад
Could you please suggest,how to preserve query string parameters on browser back back button instead of back to list button
@vivekmishra5876
@vivekmishra5876 4 года назад
I think I need to like all his videos. Such a fab Tutor.
@vankhanhnguyen9468
@vankhanhnguyen9468 5 лет назад
Best tutorial I have ever seen. thank you sir !
@DarkGT
@DarkGT 6 лет назад
Hi Venkat I truly feel in love with your SQL tutorial series, but I have a question- I want to make Inner Join with 2 Tables and to use that join with other table again as Join between Table and Join. I'm not aware how I can do that via single query or else. All help is greatly appreciated, you are one of the best online tutors I have seen on youtube, well done keep it up.
@rameshrathod01
@rameshrathod01 6 лет назад
Thank u sir great video... can make video on pagination and export data function in Angular ..It might be helpful for us...
@naveensai236
@naveensai236 4 года назад
Amazing Explanation...
@7dhananjay
@7dhananjay 6 лет назад
Hi sir, I visited many sites but did not find any tutorial on watch mode in angular. Please share if you can.... Thanks
@ksksai
@ksksai 4 года назад
Could you please suggest when to use Optional Parameter and Query Parameter
@kayjay05
@kayjay05 4 года назад
On page refresh, “?” gets converted to “%3F”. How to avoid this. Please help.
@sarikaece
@sarikaece 4 года назад
How to read headers from the request?
@purveebajaj5913
@purveebajaj5913 3 года назад
how to pass number [] as queryparameters in https get method
@crayon1202
@crayon1202 3 года назад
Add plus sign (+) to the front of the property that reads the param.
Далее
Angular read query string parameters
9:16
Просмотров 28 тыс.
Angular resolve guard
10:02
Просмотров 43 тыс.
Коротко о моей жизни:
01:00
Просмотров 286 тыс.
ПОЁМ НАРОДНЫЕ ПЕСНИ🪗
2:04:11
Просмотров 1,1 млн
Angular pure pipe
11:03
Просмотров 34 тыс.
Angular httpclient put example
12:46
Просмотров 32 тыс.
Angular property setter vs ngonchanges
13:16
Просмотров 28 тыс.
Liskov: The Liskov Substitution Principle
4:23
Просмотров 21 тыс.
Route Parameters - Angular (Tutorial #21)
14:40
Просмотров 33 тыс.
Angular 15 Call Rest API using Get with Params and POST
26:50