Creating the Component Class

In this step, we will be building App Component from our Application Architecture.


We need 3 steps to complete components. ie export, metadata and import. We will be using first step (export) with the sample code below and find out what each means:
export class AppComponent {
    pageTitle: string = 'Acme Product Management';
}

where,
'export' is export keyword
'class' is class keyword
'AppComponent' is class name
'pageTitle' is Property Name followed by camelCase
'string' is Data Type
'Acme Product Management' is Default Value

But 'class' alone is not enough to define a component. We need to define a template associated with this 'component class'. To provide this extra information to angular, we need 'metadata'.

Share this

Related Posts