This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setTimeout(function(){ | |
| console.log("callled later"); | |
| }, 1000); | |
| console.log("Called first"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const _config = require('../config'); | |
| const sql = require('mssql'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setTimeout(function(){ | |
| console.log("callled later"); | |
| }, 1000); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="container"> | |
| <div class="col-md-6"> | |
| <h3 class="title">Dynamic Form Component</h3> | |
| <dynamic-form [formConfig]="formConfig" (formSubmit)="onSubmit($event)"></dynamic-form> | |
| </div> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { DynamicControlConfig } from './dynamic-form/dynamic-control.config'; | |
| import { Component } from '@angular/core'; | |
| @Component({ | |
| selector: 'app-root', | |
| templateUrl: './app.component.html', | |
| styleUrls: ['./app.component.css'] | |
| }) | |
| export class AppComponent { | |
| formConfig: DynamicControlConfig[]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // app.module.ts | |
| import { DynamicFormModule } from './dynamic-form'; | |
| import { BrowserModule } from '@angular/platform-browser'; | |
| import { NgModule } from '@angular/core'; | |
| import { AppComponent } from './app.component'; | |
| @NgModule({ | |
| declarations: [ | |
| AppComponent, | |
| ], | |
| imports: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dynamic-form.component.ts | |
| import { DynamicFormControlComponent } from './dynamic-form-control/dynamic-form-control.component'; | |
| import { DynamicControlConfig } from './dynamic-control.config'; | |
| import { FormGroup, FormControl } from '@angular/forms'; | |
| import { Component, OnInit, Input, EventEmitter, Output, ViewChild } from '@angular/core'; | |
| import { ViewContainerRef, ComponentFactoryResolver, OnChanges } from '@angular/core'; | |
| @Component({ | |
| // tslint:disable-next-line:component-selector | |
| selector: 'dynamic-form', | |
| template: ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dynamic-form-control.component.ts | |
| import { DynamicControlConfig } from './../dynamic-control.config'; | |
| import { FormGroup } from '@angular/forms'; | |
| import { Component } from '@angular/core'; | |
| @Component({ | |
| // tslint:disable-next-line:component-selector | |
| selector: 'dynamic-form-control', | |
| template: ` | |
| <div [formGroup]="formGroup" class="form-group"> | |
| <label>{{controlConfig.label}}</label> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dynamic-form.module.ts | |
| import { DynamicFormComponent } from './dynamic-form.component'; | |
| import { ReactiveFormsModule, FormsModule } from '@angular/forms'; | |
| import { DynamicFormControlComponent } from './dynamic-form-control/dynamic-form-control.component'; | |
| import { NgModule } from '@angular/core'; | |
| import { CommonModule } from '@angular/common'; | |
| @NgModule({ | |
| imports: [ | |
| CommonModule, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // dynamic-control.config.ts | |
| export interface DynamicControlConfig { | |
| type: string; | |
| name: string; | |
| label: string; | |
| placeholder: string; | |
| } |