我在角度中添加了收藏夹图标,但是颜色没有变化,刷新时也没有显示为收藏夹。
favourite.component.html
在我添加的这些喜欢的图标中,但颜色没有改变。
<div class="dir-alp-con-right-1">
<div class="row">
<div class="row span-none" *ngIf="!isSpinner">
<div class="col-md-4" *ngFor="let x of RentData | paginate: { itemsPerPage: 9, currentPage: p }">
<a (click)="sendRentdetails(x)">
<!-- <a [routerLink]="['/saleconcreteplantdetails']" > -->
<div class="list-mig-like-com com-mar-bot-30">
<div class="list-mig-lc-img"> <img src="{{x.image1}}" alt="Image"> </div>
</div>
</a>
<div class="list-mig-lc-con">
<div class="primeimage">
<button class="btn btn-success">Rs. {{x.price}}</button>
<button class="favouri" (click)="isFavoritee(x.ad_Id)"><i class="fa"
[ngClass]="{'fa-heart' : isFavorite , 'fa-heart-o' : !isFavorite }"></i></button>
</div>
<div class="list-rat-ch list-room-rati">
<i class="fa fa-map-marker" aria-hidden="true"></i> {{x.location}} </div>
<h5>{{x.name}}</h5>
<h6>Other Machines > For Rent Other Machines</h6>
</div>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
isFavoritee(elem: any) {
this.toggle = !this.toggle;
this.favouritedata = [];
const favo = {
'login_Id': this.localservice.getLoginId() ? this.localservice.getLoginId() : '',
'ad_id' : elem ? elem : '',
'category_Id' : 27,
'mode': 'INSERT'
};
this.authservice.post('/api/Favourite/insert', favo).subscribe(data1 => {
this.favouritedata = data1;
console.log(this.favouritedata);
}, error => {
alert('something went wrong');
});
}
答案 1 :(得分:0)
我的问题是,当单击“收藏夹”按钮时,颜色没有改变,并且没有选择“刷新我的收藏夹”。
update.push("mylist").each(dataList)