代码之家  ›  专栏  ›  技术社区  ›  Stéphane GRILLON

角度2+文本区域占位符条件化和带平移

  •  0
  • Stéphane GRILLON  · 技术社区  · 7 年前

    有条件的:

    <textarea
        class="form-control"
        [placeholder]="(i < 3) ? 'a' : 'b'">
    </textarea>
    

    a a b b b b b b b b b

    <textarea
        class="form-control"
        placeholder="{{'STEPS.PLACEHOLDER' | translate}} {{title$ | async}}"
    </textarea>
    

    标题是foo

    但我需要条件和翻译:

    <textarea
        class="form-control"
        ?placeholder?="?????"
    </textarea>
    

    第二个标题是foo

    第三个标题是foo

    下一个标题是foo

    下一个标题是foo

    下一个标题是foo

    下一个标题是foo

    下一个标题是foo

    1 回复  |  直到 7 年前
        1
  •  -1
  •   Stéphane GRILLON    7 年前
    <textarea
        class="form-control"
        [placeholder]="(i < 3) ? ('STEPS.PLACEHOLDER_' + i | translate) + ' ' + (title$ | async) : ('STEPS.PLACEHOLDER_ELSE' | translate) + ' ' + (title$ | async)"
    </textarea>
    
    推荐文章