I'm displaying dynamic content by looping with md-card
tags. What I want to achieve is to show additional information when clicking on an md-card
by expanding it like an accordion.
Has anybody already tried this?
The "md" stands for "Material Design", a specific UI look-and-feel developed by Google in 2014. These are not part of Angular itself, but part of a component library built in Angular: "a set of reusable, well-tested, and accessible UI components based on Material Design": https://material.angularjs.org/latest/
The md-card, an Angular Directive, is a container directive and is used to draw cards in the angularjs application. The following table lists down the angular directives and classes used in md-card. Sr.No. Directive/Class & Description.
An accordion is a component with one or more expandable sections. CDK accordion provides a foundation upon which you can build your own custom accordion component. CDK accordion provides logic for the accordion interaction pattern without any styles.
A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options.
You can use md-item/md-card
<md-item ng-repeat="user in users" class="item"
ng-class="{ 'selected-item': $index == selectedUserIndex}">
<md-item-content class="user tile md-whiteframe-z1"
ng-class="{ 'selected md-whiteframe-z2': $index == selectedUserIndex}"
layout="column">
<div layout="row" layout-fill ng-click="selectUserIndex($index)" class="folded">
<div class="md-tile-left">
<img ng-src="{{ user.face }}" class="face">
</div>
<div class="md-tile-content" layout="column" layout-align="center start">
<h3>{{ user.name.first + " " + user.name.last }}</h3>
<p ng-hide="$index == selectedUserIndex">
<span>Something</span>
</p>
</div>
</div>
<md-divider layout-fill ng-show="$index == selectedUserIndex"></md-divider>
<div layout="column" layout-fill class="expanded">
<span>some content</span>
<br/>
<span>some content</span>
<br/>
<span>some content</span>
<br/>
<span>some content</span>
<br/>
<span>some content</span>
<br/>
<span>some content</span>
<br/>
<span>some content</span>
</div>
</md-item-content>
<md-divider class="divider-inset" ng-if="!$last"></md-divider>
</md-item>
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With