Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Ion-input is always readonly

$
0
0

@mohitraj wrote:

I have just started experimenting with ionic and have tried the example from https://ionicframework.com/docs/developer-resources/forms/

No matter what I try but every comes as similar to a label, which means I can't get edit it. Here is a snippet of the template I have -

@Component({
  template: '
    <form [ngFormModel]="todo" (ngSubmit)="logForm();">
	  <ion-item>
		<ion-input type="text" formControlName="test"></ion-input>
	  </ion-item>
	  <ion-item>
        <ion-label floating>Todo</ion-label>
        <ion-input type="text" formControlName="title" [disabled]="false" required>Title goes here</ion-input>
      </ion-item>
      <ion-item>
        <ion-label>Description</ion-label>
        <ion-textarea formControlName="description">jghjghj</ion-textarea>
      </ion-item>
      <button ion-button type="submit" [disabled]="!todo.valid">Create</button>
    </form>
  '
})

export class FormsPage implements OnInit{

	private todo : FormGroup;

  constructor(public formBuilder: FormBuilder) {

    this.todo = this.formBuilder.group({
      title: ['', Validators.required],
      description: ['']
    });
  }

  ngOnInit(): any {
	this.todo = this.formBuilder.group({
		title: ['', Validators.required],
		description: ['']
	});
  }

  logForm(){
    console.log(this.todo.value);
  }
}

This is what show on web -

Any ideas to suggest what am I missing would be welcome.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>