RUVIDEO
Поделитесь видео 🙏

Angular 9 Tutorial - 20 - Component Life Cycle in Angular

? Subscribe for more angular videos with live examples
http://www.youtube.com/channel/UC-FyE8pmbzUw7sb293FOdlA?sub_confirmation=1

You can find the code in git-hub:
https://github.com/sadupawan1990/Angular

In this video we will discuss about component lifecycle in Angular. Let us understand this with example.

Angular executes the lifecycle hooks after executing the component constructor.

below is the sequence of execution

ngOnChanges()
ngOnInit()
ngDoCheck()
ngAfterContentInit()
ngAfterContentChecked()
ngAfterViewInit()
ngAfterViewChecked()
ngOnDestroy()

Code :

lifecycle.component.ts

import { Component, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';

@Component({
selector: 'app-lifecycle',
templateUrl: './lifecycle.component.html',
styleUrls: ['./lifecycle.component.css']
})
export class LifecycleComponent {

@Input() inputValue : string;
contentLength : string;

constructor() {
console.log('Constructor');
}

ngOnInit(): void {
}

ngOnChanges(changes : SimpleChanges): void {
console.log('NgOnChanges');
console.log(changes);
if(this.inputValue && this.inputValue.length ) 5){
this.contentLength = 'long';
}else{
this.contentLength = 'short';
}
}

}

app.component.ts

import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
inputText : string;

resetEmployees(eventData){
this.empList = eventData;
}
}

app.component.html

input type="text" [(ngModel)]="inputText" /

app-lifecycle [inputValue] = "inputText" /app-lifecycle

lifecycle.component.html

p lifecycle works! /p
h2
{{inputValue}}
/h2
h2
Text Length is - {{contentLength}}
/h2

Search Tags
component life cycle in angular | component lifecycle hooks | component life cycle in angular 7 | angular component lifecycle hooks | angular component lifecycle hooks with example | angular component lifecycle | angular lifecycle hooks | angular life cycle | angular lifecycle hooks explained | angular life cycle interview questions | ngonchanges lifecycle hook example | ngonchanges is not working | ngonchanges angular 9 | ngonchanges multiple input | ngonchanges vs setter | ngonchanges simplechange | ngonchanges() angular | angular ngonchanges | angular | angular tutorial | angular ngOnchanges example | angular tutorial for beginners |

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Angular 9 Tutorial - 20 - Component Life Cycle in Angular», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.