angularjs - How do i conditionally change the parameter of an angular filter -


i have custom angular filter, ellipsesfilter, use truncating , adding ellipses words long fit in particular table.

like this:

<div>{{app.firstlastname | ellipsesfilter:13 }}</div> 

however, if app.flag true add word end of firstlastname. if that's case, want ellipses filter param different. ideally, this

{{app.firstlastname | app.flag? : ellipsesfilter:10 : ellipsesfilter:13}} 

i've tried various ways of doing this, none have worked. know how?

you close.. can use ternary operator switch parameter value this:

{{name | ellipsesfilter:flag ? 10 : 13}} 

here demo: http://plnkr.co/zwsnk1vzvgbzeogb5ncp


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -