Angular Directive And Component - BEHIND JAVA

Angular Directive And Component

Share This

Angular Component

A component is a main UI building block of Angular application (Angular 2 and above). The angular application set as a tree of components. Every Angular application must have at least one component. A component class is an execution context for the template or it is a component controller. A component requires a single component decorator and at least one @View decorator.

Angular Directive

A component is not the only UI building block in Angular 2. There are also directives which allow you to attach behaviour to elements in the DOM.

The difference between a component and a directive in Angular 2 is that a component is a directive with a view whereas a directive is a decorator with no view.

A directive requires a single @Directive decorator and a directive class:

No comments:

Post a Comment

Pages