Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular “编辑”按钮单击“获取图像名称”并显示使用“角度”选择的输入文件_Angular_Asp.net Mvc - Fatal编程技术网

Angular “编辑”按钮单击“获取图像名称”并显示使用“角度”选择的输入文件

Angular “编辑”按钮单击“获取图像名称”并显示使用“角度”选择的输入文件,angular,asp.net-mvc,Angular,Asp.net Mvc,单击编辑按钮时,我希望能够删除“未选择文件”以添加类别.ImageName。在输入中添加了[(ngModel)]=“category.ImageName”,但它不工作 <div *ngIf="category.FileSource.length > 0; else customAvatar"> <input formCont

单击编辑按钮时,我希望能够删除“未选择文件”以添加类别.ImageName。在输入中添加了[(ngModel)]=“category.ImageName”,但它不工作

<div *ngIf="category.FileSource.length > 0; else customAvatar">
                                <input 
                                formControlName="File"
                                id="File" 
                                type="file" 
                                [value]="category.ImageName"
                                [(ngModel)]="category.ImageName"
                                (change)="onFileChange($event)"/>
                               
                                <img *ngIf="chnageeventimage==='true'; else changeAvatar" [src]="imageSrc || '../../../../../assets/images/camera.jpg'" style="height: 80px; width:80px">
                                <ng-template #changeAvatar>
                                <img  [src]="category.FileSource" style="width:80px; height:80px;" alt="User avatar" />
                            </ng-template> 
发出


您可以隐藏输入并自定义div或按钮,如下所示:


上传图像
{{category.ImageName}

我认为您不能直接影响该文本。我认为您必须隐藏整个元素,并将您自己的组件作为可视和代理应用。或者,使用类似的库
ngOnInit(): void {
    debugger;
    const categoryID: string = this.route.snapshot.queryParamMap.get('categoryID');
     this.api.EditCategory(categoryID).subscribe(data =>{
      console.log(data);
      this.category = data;
    });
  }