@goussama/ionic-rating-component
Version:
Highly customizable ionic 6 component to display evaluations or a quick rating operation of something.
28 lines (21 loc) • 658 B
text/typescript
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
({
providedIn: 'root'
})
export class IonicRatingService {
private starRatingSubject = new Subject<number>();
private topicSubject = new Subject<{ [key: string]: any }>();
publishStartRatingChanged(value: number) {
this.starRatingSubject.next(value);
}
getStartRatingChangedObservable(): Subject<any> {
return this.starRatingSubject;
}
publishTopic(topic: string, value: number) {
this.topicSubject.next({ topic, value });
}
getTopicObservable(key): Subject<any> {
return this.topicSubject[key];
}
}