Answers for "ngmodel custom component"

0

ngmodel component angular

import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-input',
  template: `  <input type="text" [(ngModel)]="inputModel" (ngModelChange)="inputModelChange.emit(inputModel)"/>`,
  styleUrls: ['./app-input.component.scss']
})
export class AppInputComponent {
  @Input() inputModel: string;
  @Output() inputModelChange = new EventEmitter<string>();
}
Posted by: Guest on June-23-2020
0

custom ngmodel

<app-my-control [(myProp)]="value"></app-my-control>


@Input()
myProp: string;

// Output prop name must be Input prop name + 'Change'
// Use in your component to write an updated value back out to the parent
@Output()
myPropChange = new EventEmitter<string>();
Posted by: Guest on September-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language