Home > Software design >  I have to set the character count using ngclass in Angular
I have to set the character count using ngclass in Angular

Time:11-12

app.component.html:

      <div 
          <span >{{item.name}}</span>
      </div>

if item.name character was more than 300 then the height of that should be 100px. else 50px.

CodePudding user response:

Try this :

  <div >
              <span  [style.height]='item.name.length > 300 ? "100px" : "50px"'>{{item.name}}</span>
          </div>
  • Related