Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export class RatingsComponent {
- ...
- set rating(v) {
- this._rating = v;
- // triggers DOM update
- this.updateRatings();
- }
- get rating() {
- return this._rating;
- }
- updateRatings() {
- this.elements.forEach((element, index) => {
- if (index < this.rating) {
- element.classList.remove('outline');
- element.classList.add('solid');
- } else {
- element.classList.remove('solid');
- element.classList.add('outline');
- }
- });
- }
- }
Add Comment
Please, Sign In to add comment