What are components?

Components are the most basic UI building block of an Angular app which formed a tree of Angular components. These components are subset of directives. Unlike directives, components always have a template and only one component can be instantiated per an element in a template. Let's see a simple example of Angular component

import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `
<div>
<h1>{{ title }}</h1>
<div>Learn Angular6 with examples</div>
</div>
`,
})
export class AppComponent {
title: string = 'Welcome to Angular world';
}

Author of content
Edit this page

Made by Michael Sakhniuk

Twitter