How to take the mat-Selection-list "Aria-Selected" attribute with angular?

Asked

Viewed 146 times

0

I own a mat-accordion that has a mat-Selection-list in an internal way.

I saw that inside this mat-Selection-list has an attribute that calls Aria-Selected, I need to take the data of the checkbox that is with this Aria-Selected marked as true.

How to do this?

The result of my rendered html

<mat-list-option _ngcontent-c6="" checkboxposition="before" class="mat-list-item mat-list-option ng-star-inserted" role="option" tabindex="-1" ng-reflect-checkbox-position="before" ng-reflect-value="[object Object],[object Object" aria-selected="true" aria-disabled="false">
    <div class="mat-list-item-content"><div class="mat-list-item-ripple mat-ripple" mat-ripple="" ng-reflect-disabled="false" ng-reflect-trigger="[object HTMLElement]"></div>
    <mat-pseudo-checkbox class="mat-pseudo-checkbox mat-pseudo-checkbox-checked" ng-reflect-state="checked" ng-reflect-disabled="false">
    </mat-pseudo-checkbox>
    <div class="mat-list-text">
       <div _ngcontent-c6="" class="container">
         <div _ngcontent-c6="" class="row">
          <div _ngcontent-c6="" class="col-md-12">
              Radiologia
          </div>
        </div>
      </div>
    </div>
  </div>
 </mat-list-option>

1 answer

0

You can assign a template variable reference to it, #accordion, and pass it inside the method you need ex:

change(#accordion) 

and there you look for the property you need inside.

to learn more about https://angular.io/guide/template-syntax, template Reference variable

Browser other questions tagged

You are not signed in. Login or sign up in order to post.