简体   繁体   中英

Angular Material md-virtual-repeat list item selection

I am not clear on how to setup so I can select an item from a virtual repeat list. I would like the onclick of an item to set a model variable and display the ripple animation.

<div layout="column" flex="40" style="border:red 1px solid;min-height:75px;margin-right:0px;padding-right:0px;padding-bottom:0px;" layout-padding>
    <md-virtual-repeat-container id="rightSrc" layout-fill flex>
      <div md-virtual-repeat="s in items" class="repeated-item" flex>
        {{s.title}}
      </div>
    </md-virtual-repeat-container>
</div>

I have a Codepen here: http://codepen.io/ed4becky/pen/LGabqW

The demo displays without showing how to setup for selection

You can use md-button and md-ink-ripple . This should get you started, you probably just need to tweak some margins/paddings.

<div md-virtual-repeat="s in items | orderBy:'title'" class="repeated-item md-button" flex md-ink-ripple ng-click="alert(s)">
    {{s.title}}
</div>

http://codepen.io/kuhnroyal/pen/bEZzpY

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM