4 nested components


import { Component } from '@angular/core';
@Component({ //metadata start
selector: 'app-employee',
templateUrl:'./employee.component.html'
}) //metadata end

export class EmployeeComponent {//abov comp decorator add metadata to empcompnt class
firstName: string ="Mahesh";
lastName: string ="vemudala";
gender: string ="Male";
age: string ="20";
}


html view
<!DOCTYPE html>
<html>
<head>
</head>
<body>

<table>
<tr>
<td>firstName</td>
<td>{{firstName}}</td>
</tr>
<tr>
<td>lastName</td>
<td>{{lastName}}</td>
</tr>
<tr>
<td>gender</td>
<td>{{gender}}</td>
</tr>
<tr>
<td>Age</td>
<td>{{age}}</td>
</tr>
</table>

</body>
</html>
What is app module?
APPMODULE is the root module which bootstraps and launches the angular application
open app.module.ts
//systm modules are ngmodule, brwser module....
import NGmodule// to add metadeta to an angular module ie(export appModule)
import browser module //required by all ng app that run in web browser also provides
ngif ngfor directives..

import {EmployeeComponent } from './employee.compoent';
....
{
declarations: [AppComponent, EmployeeComponent]
}

Comments

Popular posts from this blog

reactjs questions part 4

ReactJS: How and when to force a React component to re-render

Q: Error Boundary in React that catches an error and displays a fallback UI