如何在angular2材質中添加md-card中的填充?我使用MD-卡顯示我的產品列表,但我不能對他們添加填充,這裏是我做的:如何在angular2材質中的md-card中添加填充?
product.component.html:
<p>
Product List
</p>
<div class="container">
<div class="col-sm-2 filter-area">
<div>Filter area</div>
<div>Search area</div>
<div>Category area</div>
<div>Widget area</div>
</div>
<div class="col-sm-10">
<md-card class="example-card" *ngFor="let data of (myData ? myData.slice(0,5): []); let i = index">
<img md-card-image src="{{ data.url }}">
<md-card-header>
<md-card-title>{{ data.title }}</md-card-title>
</md-card-header>
<md-card-actions>
<button md-button>Add to Cart</button>
<button md-button>Buy Now</button>
</md-card-actions>
</md-card>
</div>
</div>
,這裏是我的產品.component.ts:
myData: Array<any>;
constructor(private http:Http) {
this.http.get('https://jsonplaceholder.typicode.com/photos')
.map(response => response.json())
.subscribe(res => this.myData = res);
}
這就是我如何顯示我的JSON數據,這是我使用我的原型設計樣本JSON數據。下面是我使用(如果你觸發我的構造函數應該看起來像下面的地址)5 JSON數據:
[
{
"albumId": 1,
"id": 1,
"title": "accusamus beatae ad facilis cum similique qui sunt",
"url": "http://placehold.it/600/92c952",
"thumbnailUrl": "http://placehold.it/150/92c952"
},
{
"albumId": 1,
"id": 2,
"title": "reprehenderit est deserunt velit ipsam",
"url": "http://placehold.it/600/771796",
"thumbnailUrl": "http://placehold.it/150/771796"
},
{
"albumId": 1,
"id": 3,
"title": "officia porro iure quia iusto qui ipsa ut modi",
"url": "http://placehold.it/600/24f355",
"thumbnailUrl": "http://placehold.it/150/24f355"
},
{
"albumId": 1,
"id": 4,
"title": "culpa odio esse rerum omnis laboriosam voluptate repudiandae",
"url": "http://placehold.it/600/d32776",
"thumbnailUrl": "http://placehold.it/150/d32776"
},
{
"albumId": 1,
"id": 5,
"title": "natus nisi omnis corporis facere molestiae rerum in",
"url": "http://placehold.it/600/f66b97",
"thumbnailUrl": "http://placehold.it/150/f66b97"
}
]
,這裏是我的CSS文件,product.component.css:
.example-card {
width: 220px;
float: left;
padding: 30px;
}
.filter-area {
background-color: peachpuff;
}
如何在那裏添加填充?
謝謝!這是真的,我不能申請補丁在md卡,現在的作品,現在謝謝你 –