Angular input change detection using property setter

preview_player
Показать описание
In this video we will discuss how to detect and react when component input property value changes using a property setter.

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.

In our previous video we discussed, detecting and reacting to INPUT property changes using ngOnChanges life cycle hook. In this video we will discuss doing the same using a Property Setter instead.

Text version of the video

Slides

Angular CRUD Tutorial

Angular CRUD Tutorial Text Articles & Slides

All Dot Net and SQL Server Tutorials in English

All Dot Net and SQL Server Tutorials in Arabic

Detecting and reacting to Input property changes using Property Setter

// Private backing field for the property
private _employee: Employee;

// This property setter is called anytime the input property changes
// Notice the code here logs the previous and current employee names
@Input()
set employee(val: Employee) {
this._employee = val;
}

// This getter is called when reading and displaying data
get employee(): Employee {
return this._employee;
}

At this point you might be thinking, there are 2 ways to detect and react to Input property changes (Property Setter and ngOnChanges life cycle hook). What is the difference between the two and when to use one over the other. We will answer these 2 questions in our next video.
Рекомендации по теме
Комментарии
Автор

Your explaination and ur voice is so clear

dhiruparmar
Автор

Hi @Venkat I'm trying bind cascading dropdowns while editing a record and I'm using a single dialog as a reactive form. But in edit mode the first dropdown is binding properly but not the others and it is throwing can you help please

soumadevghosh
Автор

Clear explaination, thank you for the video !

loganrizzo
Автор

Hi venkat, it is awesome to watch your videos. I learned all most angular. I have a request for you make videos on Angular5 HTTPclient and Interceptors

guruvardhanaraopanidam
Автор

Voice is very clear... Awesome explaination..

saranyaashokkumar
Автор

Should any changes be done for the set methods to support Internet Explorer? I get an error - Object doesn't support property or method 'set'.
It works fine in Firefox and Chrome

zeusnn
Автор

I didnt saw previous video and wanted to see template code.

fenix
Автор

sir please make a video about asp.net mvc core 1.0

NepaliSecondLife
join shbcf.ru