i have a form with radio button, if user selects no then a default value s'0' should be added to the input tag, i tried setting 0 as a default value when form is been loaded using value='0'
but this value is not reflected when the form is loaded.
<form #form="ngForm" (ngSubmit)="modifyMilkForm(form)" novalidate>
<ion-row>
<ion-col style="text-align: right;">
<ion-label><b>Today Received :</b></ion-label>
</ion-col>
<ion-col>
<ion-list radio-group name="checkBox" [(ngModel)]="autoManufacturers">
<ion-item>
<ion-label>Yes</ion-label>
<ion-radio [value]="true"></ion-radio>
</ion-item>
<ion-item>
<ion-label>No</ion-label>
<ion-radio [value]="false"></ion-radio>
</ion-item>
</ion-list>
</ion-col>
</ion-row>
<ion-row>
<ion-col style="text-align: right;" >
<ion-label><b>Price :</b></ion-label>
</ion-col>
<ion-col>
<ion-item name="price" [(ngModel)]="enteredPrice" required>
<ion-input type="number" value="0" placeholder="Number"></ion-input>
</ion-item>
</ion-col>
</ion-row>
<button small [disabled]=!form.valid style="text-transform: none" ion-button type="submit" value="Submit" small>Submit</button>
</form>
could someone help me to fix this
Here it is
class initRadioGroup { selectedRadio = {"value":"N"}; }
<md-radio-group class="form-control" [(ngModel)]="selectedRadio.value" id="radioList" formControlName="selectedRadio"> <md-radio-button [value]="'N'">N</md-radio-button> <md-radio-button [value]="'M'">M</md-radio-button> </md-radio-group>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.