Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
199 views
in Technique[技术] by (71.8m points)

Radio buttons not working or reacting - angular 9

working code

                <form class="form-horizontal">
              <div class="row">
                <div class="col-md-6">
                  <div class="form-group row mb-0">
                    <label class="col-md-5 col-form-label">
                      {{ "SearchByField" | localize }}
                    </label>
                    <div class="col-md-7 pt-2">
                      <div *ngFor="let item of searchType; index as i" [ngClass]="{'mx-3': (i > 0 && i < searchType.length)}" class="custom-control custom-radio d-inline">
                        <input
                          type="radio"
                          class="custom-control-input"
                          [id]="'SearchByType' + item.value"
                          name="SearchByTypeRadio"
                          [(ngModel)]="this.seachByTypeValue"
                          [value]="item.value"
                        />
                        <label class="custom-control-label" for="isActiveAll">
                          {{ item.text | localize }}
                        </label>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <label class="col-form-label col-3" for="name">
                  {{ "FilterByLocation" | localize }}:
                </label>
                <div class="input-group">
                  <select 
                  name="locationFilter"
                  id="locationFilter"
                  required
                  [(ngModel)]="this.locationId"
                  #locationFilterModel="ngModel"
                  #locationFilterEl
                  class="form-control">
                    <option *ngFor="let c of locations; let i = index" [value]="c.value">{{ c.text }}</option>
                  </select>
                </div>
              </div>
            </form>

Probelm i have is that my radio buttons don't react at all. Even if i place on change event to fire function it's doesn't fire it. Looks like angular is broken. Strange is that when i create testing solution with the same code it works without problems. I don't know how to debug this as i don't get any errors in console window.

question from:https://stackoverflow.com/questions/65871441/radio-buttons-not-working-or-reacting-angular-9

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...