Загрузка...

3 AngularJS Components को समझना

A component is basically a specialized, simplified directive designed for a component-based architecture, which prepares your application for migrating to Angular 2+
Unlike directives that use a factory function, components are defined by passing a simple configuration object that dictates the view (template) and the business logic (controller).

Components use specific symbols to define how data is bound to the parent scope

= is used for two-way data binding.
'angled brackets' is used for one-way binding (reading a parent scope value without updating it).
@ is used for passing string parameters.
& is used for callbacks to output data or events back to the parent scope.

Controller Integration: Components automatically bundle a view and a controller, and by default, Angular assigns the alias $ctrl to the controller within the HTML template

Lifecycle Hooks: Introduced in Angular 1.5.3, components have powerful built-in hooks to manage their lifecycle execution

$onInit(): Ideal for initialization code; it runs after the controllers are constructed and bindings are initialized

$onChanges(): Called whenever one-way bindings update, providing an object with the current and previous values

$onDestroy(): Triggered when the scope is destroyed, used to clean up external resources or watchers

$postLink() and $doCheck(): Used for post-linking child elements and acting on changes during the digest cycle.

Inter-Component Communication: A child component can access data from a parent component by utilizing the require property
. This gives you a reference to the parent's controller, which is guaranteed to be ready and accessible inside the $onInit hook
Check out the pdf on chapter 3
https://drive.google.com/file/d/1iYUw34sFKFT3utg2NPDW4JLTaI51CXhu/view?usp=sharing

Видео 3 AngularJS Components को समझना канала Binary N Beyond
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять