Angularjs picture upload echo __js

Source: Internet
Author: User

function Imgfile (file) {
    var reader = new FileReader ();
    $scope. Guid = (new Date ()). valueof ();   Creates a random number with a timestamp, using the
    reader.onload = function (ev) {
        $scope. $apply (function () {
            $scope. Thumb.push (;
    Reader.readasdataurl (file);  FileReader, turn the picture into Base64
$scope. img_upload = function (files) {for
  (var  img=0;img< Files.length img++) {
      $scope. Imgfilesdata.push (files[img]);
      Imgfile (files[img]);
<!--photos--> <div> <section> <div> <div ng-repeat="Item inThumb"> <!--use angular cycle to display thumb pictures--> <label> <i MG ng-src="{{Item}}" class="Float-left padding-left-8"Width="70px"height="70px"/> </label> </div> <div > <div class="Float-left"> <input type="File"Id="One-input"accept="image/*"multiple="multiple"File-model="Images"style="; z-index:99999 Margin-left:-70px; height:70px; width:70px; opacity:0" Onchange="Angular.element (this). Scope (). Img_upload (This.files)"/> <div class="width-70 height-70 float-left margin-left-5 line-height-70 background-e5"> <i class="Ion-image font-size-20 color-888"></i> </div> </div> </div> </div> </section> </div>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: