adding dynamic image to table column does not work in angularjs

前端 未结 1 1324
刺人心
刺人心 2021-01-19 23:34

I\'m new to angulajs and I\'m trying to dynamically add image to a column when user selects it. Here is the below code and it did not work. code in .cshtml file ---

1条回答
  •  逝去的感伤
    2021-01-19 23:59

    For your example, which looks quiet straight forward. I would recommend not to get into any plugin. Check this plukr

      $scope.imageUpload = function(event){
       var files = event.target.files; 
       var reader = new FileReader();
       reader.onload = $scope.imageIsLoaded; 
       reader.readAsDataURL(files[0]);
      }
    
      $scope.imageIsLoaded = function(e){
       $scope.$apply(function() {
          $scope.path = e.target.result;
       });
      }
    

    and in your html

    
    

    NOTE: : ng-change is not supported for type file

    0 讨论(0)
提交回复
热议问题