1
I’m writing an angular code and I’m trying to make a situation where, by choosing the name of a city, depending on its size, the size of the space that bears the name increases depending on the name of the city. I tried to make a class in css that only activates when the condition happens but keeps giving error and I don’t know why. Here’s the angular snippet:
<div [ngClass]="{city.length < 16 ? 'desktopCityFilterName' : 'desktopCityFilterName2'}">{{city}}
Here the css:
.desktopCityFilterName {
padding-right: 0px;
padding-left: 15px;
width: 115px;
}
.desktopCityFilterName2 {
padding-right: 0px;
padding-left: 15px;
width: 189px;
}
In case I was clear, the user chooses a city and the display increases the size of the space in which the name is written if the city name exceeds 16 characters.
Ex: Aracajú less than 16, thus width continues 115px
Jordan Fields more than 16, so width becomes 189px