Angularjs com file upload - Jasny

Asked

Viewed 211 times

0

I have 2 problems when I open my modal:

  1. After opening the modal, select a photo and close, when I open again, the photo that was not reset (reset), I’m having doubts about how to pass null to this variable.

  2. I’d like to move a picture from the server to the second button, but I don’t know how to do that.

I mounted a plunker to help understand the problem:

<!DOCTYPE html>
<html ng-app="MyApp">

<head>
  <meta charset="utf-8" />
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js"></script>

  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/css/jasny-bootstrap.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/3.1.3/js/jasny-bootstrap.min.js"></script>

  <script src="jasny-bootstrap-angular.js"></script>

  <link rel="stylesheet" href="style.css">

  <script src="app.js"></script>

</head>

<body ng-controller="JasnyfoController">
  <br />
  <button data-ng-click="openmodal()" class="btn btn-primary">Open (null) Modal</button>

  <button data-ng-click="openmodal2()" class="btn btn-primary">Open from picture Modal</button>

  <div class="modal fade" id="jasnymodal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
          <h4 class="modal-title" id="H1" ng-hide="editMode || viewMode">Jasny Modal - Pass null to Jasny</h4>
        </div>
        <div class="modal-body">


          <br />
          <br />

          <js-file-input ng-model="fileinput" data-input-attrs='{"name": "fileInput"}' data-preview-attrs='{"style": "width: 159px; height: 100px;"}'></js-file-input>
          <br />
          <br />
          <button class="btn btn-info" ng-click="showInput()">Show Input</button>

        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>

        </div>
      </div>
    </div>
  </div>

  <div class="modal fade" id="jasnymodal2" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
          <h4 class="modal-title" id="H1" ng-hide="editMode || viewMode">Jasny Modal - Pass a image from server to Jasny</h4>
        </div>
        <div class="modal-body">


          <br />
          <br />

          <js-file-input ng-model="fileinput" data-input-attrs='{"name": "fileInput"}' data-preview-attrs='{"style": "width: 159px; height: 100px;"}'></js-file-input>
          <br />
          <br />
          <button class="btn btn-info" ng-click="showInput()">Show Input</button>

        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>

        </div>
      </div>
    </div>
  </div>


</body>

</html>

1 answer

1


Browser other questions tagged

You are not signed in. Login or sign up in order to post.