|
| 1 | +import 'zone.js/dist/zone'; |
| 2 | +import { Component } from '@angular/core'; |
| 3 | +import { CommonModule } from '@angular/common'; |
| 4 | +import { bootstrapApplication } from '@angular/platform-browser'; |
| 5 | +import { FormsModule } from '@angular/forms'; |
| 6 | +import { Project } from './servce'; |
| 7 | + |
| 8 | +@Component({ |
| 9 | + selector: 'my-app', |
| 10 | + standalone: true, |
| 11 | + imports: [CommonModule, FormsModule], |
| 12 | + template: ` |
| 13 | + <h1>Hello from {{name}}!</h1> |
| 14 | +
|
| 15 | + <div class="container row"> |
| 16 | + |
| 17 | + <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> |
| 18 | + <div class="card"> |
| 19 | + <div class="card-header"> |
| 20 | + <h3 class="card-title"> |
| 21 | + Temporary Project For Learning |
| 22 | + </h3> |
| 23 | + </div> |
| 24 | + <div class="card-body" *ngFor="let i of tempproejcts "> |
| 25 | + <form class="form-horizontal"> |
| 26 | + <div class="row" > |
| 27 | + |
| 28 | + <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6" > |
| 29 | + <label class="form-label">Name</label>: |
| 30 | + <input type="text" placeholder="Please Write Name" [(ngModel)]="i.name" [ngModelOptions]="{standalone: true}"> |
| 31 | + </div> |
| 32 | + <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6"> |
| 33 | + <label class="form-label">Age</label>: |
| 34 | + <input type="text" placeholder="Please Age" [(ngModel)]="i.age" [ngModelOptions]="{standalone: true}"> |
| 35 | + |
| 36 | + </div> |
| 37 | +
|
| 38 | + |
| 39 | + |
| 40 | + </div> |
| 41 | + |
| 42 | + </form> |
| 43 | + </div> |
| 44 | + |
| 45 | + </div> |
| 46 | + <button type="button" class="btn btn-primary mt-3" (click)="createreplicate($event)">Add New Block </button> |
| 47 | + </div> |
| 48 | + `, |
| 49 | +}) |
| 50 | +export class App { |
| 51 | + name = 'Angular'; |
| 52 | + |
| 53 | + //tempproejct: any[] |
| 54 | + public tempproejct = new Project(); |
| 55 | + public tempproejcts = []; |
| 56 | + |
| 57 | + createreplicate(days: any) { |
| 58 | + |
| 59 | + //let count = 1; |
| 60 | + //let length = this.tempproejcts.length +1; |
| 61 | + const tempobj = Object.assign({}, this.tempproejct); |
| 62 | + //tempobj.no = this.tempproejcts.length + 1; |
| 63 | + this.tempproejcts.push(tempobj); |
| 64 | + //this.tempproejcts.length + 1; |
| 65 | + |
| 66 | + |
| 67 | + // for(let i=0; i<length; i++){ |
| 68 | + // alert(1) |
| 69 | + // tempobj[i]["no"] = count; |
| 70 | + // count++; |
| 71 | + // this.tempproejcts.push(tempobj); |
| 72 | + // } |
| 73 | + // length++; |
| 74 | + //console.log(this.tempproejcts.push(tempobj)); |
| 75 | + //tempobj.no = this.tempproejcts.length+1; |
| 76 | + //for (let i = 0; i < length; i++) { |
| 77 | + // this.tempproejcts.push(tempobj); |
| 78 | + // console.log(this.tempproejcts); |
| 79 | + //} |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +bootstrapApplication(App); |
0 commit comments