Datacollection
Datacollection
C:\users\hp\cd hero-form
C:\users\hp\hero-form\
Hero-form.component.css
h1{
text-align: center;
font-display:inherit;
background-color: chartreuse;
}
Hero-form.component.html
<div class="container">
<h1>Hero Form</h1>
<form>
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control"
id="name" required>
</div>
<div class="form-group">
<label for="alterEgo">Alter Ego</label>
<input type="text" class="form-control"
id="alterEgo">
</div>
<div class="form-group">
<label for="power">Hero Power</label>
<select class="form-control" id="power"
required>
<option *ngFor="let pow of powers"
[value]="pow">{{pow}}</option>
</select>
</div>
<button type="submit" class="btn btn-success"
>Submit</button>
</form>
</div>
Hero-form.component.ts
import { Component } from '@angular/core';
import { Hero } from '../hero';
@Component({
selector: 'app-hero-form',
templateUrl: './hero-form.component.html',
styleUrls: ['./hero-form.component.css']
})
export class HeroFormComponent {
}
App.component.html
<app-hero-form></app-hero-form>
App.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule, provideClientHydration }
from '@angular/platform-browser';
import { HeroFormComponent } from
'./hero-form/hero-form.component';
import { AppRoutingModule } from './app-
routing.module';
import { AppComponent } from './app.component';
import { FormsModule } from '@angular/forms';
@NgModule({
declarations: [
AppComponent,
HeroFormComponent
],
imports: [
BrowserModule,
AppRoutingModule,
FormsModule
],
providers: [
provideClientHydration()
],
bootstrap: [AppComponent]
})
export class AppModule { }