use ternary in angular template code example Example: ternary operator angular template <span> {{selectedSport.key === 'walking' ? 'steps' : 'km'}} </span>