代码之家  ›  专栏  ›  技术社区  ›  Vivek Nuna Chetan sabhaya

隐藏不使用角度数组

  •  0
  • Vivek Nuna Chetan sabhaya  · 技术社区  · 6 年前

    我试图用 [hidden] 属性使用数组元素,但其给定的模板分析错误。

    <img id="ProfilePictureResize_{{i}}" [hidden]="!{{temporarySubCategoryImageShow[i]}}" src="{{temporarySubCategoryImageUrl[i]}}"/>
    

    但当我试着 [隐藏] 具有 boolean 变化无常,效果很好。

    <img id="ProfilePictureResize_{{i}}" [hidden]="!isPreviewImage" src="{{temporarySubCategoryImageUrl[i]}}"/>
    

    TS文件:

    public temporarySubCategoryImageShow: string[] = [];
    private isPreviewImage: boolean = false;
    

    错误屏幕截图:

    enter image description here

    2 回复  |  直到 6 年前
        1
  •  2
  •   Abel Valdez    6 年前

    删除插值 "{{}}" 在里面 [hidden] 属性

     [hidden]="!temporarySubCategoryImageShow[i]"
    
        2
  •  1
  •   bugs    6 年前

    您必须从 hidden 属性。

    [hidden]="!temporarySubCategoryImageUrl[i]"