I am trying to make a simple Angular4 web app that will show and X or O depending on what the rating is. I do not see the X or O in my web app.
The CSS classes in my rating.component.ts file are not working. My project is compiling because I can add text to my rating component template and it will show up on the webpage, but I cannot see the CSS that suppose to be rendered.
My app component:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<rating></rating>
`,
styleUrls: ['./app.component.css']
})
export class AppComponent {
}
My rating component:
import { Component } from '@angular/core';
@Component({
selector: 'rating',
template: `
<i class="star"
[class.star-empty-icon]="rating < 1"
[class.star-full-icon]="rating >= 1"
(click)="onClick(1)">
</i>
<i class="star"
[class.star-empty-icon]="rating < 2"
[class.star-full-icon]="rating >= 2"
(click)="onClick(2)">
</i>
`
})
export class RatingComponent{
rating = 0;
onClick(ratingValue){
this.rating = ratingValue;
}
}
My Css:
.star.star-full-icon{
content:'X';
}
.star.star-empty-icon{
content:'O';
}