In brief, I want to create components of text input fields, so as to replace the commented out code that works with the component.
<app-text-input [name]="Address" [mod]="resto.address" class="col-sm"></app-text-input>
<!--<div class="form-group col-sm">
<label for="Address">Address</label>
<input type="text" class="form-control" id="Address" name="Address" [(ngModel)]="resto.address" >
</div>-->
my component reads
@Component({
selector: 'app-text-input',
template: `
<div class="form-group">
<label for="name">{{name}}</label>
<input type="text" class="form-control" id="name" name="name" [(ngModel)]="mod" >
</div>
`,
styles: ['']
})
export class TextInput {
@Input() name: String;
@Input() mod;
constructor() { }
}
I get the value of the field being set, but none of the changes are making it back up. I'm pretty sure I am doing something fundamentally wrong but all the examples I found online to date are in the long-hand style I am trying to abstract out.