Topic: How to pass radio button value as parameter on angular calls?

davout free asked 3 years ago


Beginner Angular question...

In the code example shown below I have a 'value' set to '0'. In the two binding calls for "[checked]" and "(change)" I am setting the method calls to '0'.

<div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input" id="view1" name="taskView" [checked]="isCurrentView(0)" mdbInput value="0" (change)="changeTaskView(0)">
        <label class="custom-control-label" for="view1">Day</label>
  </div>

Is there any way to use the 'value' property in the [checked]" and "(change)" method calls?

Like..

<div class="custom-control custom-radio">
        <input type="radio" class="custom-control-input" id="view1" name="taskView" [checked]="isCurrentView($self.value)" mdbInput value="0" (change)="changeTaskView($self.value)">
        <label class="custom-control-label" for="view1">Day</label>
  </div>

The example shown above doesn't work. How can I pass the tag value field as a param to both the angular bindings?



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Opened

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: 9.3.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No