Angularjs with file upload - jasny

0

I have 2 problems when I open my modal:

  • After opening the modal, select a photo and close, when I open again, the photo that was not reset, I am in doubt about passing null to this variable.

  • I'd like to pass a photo from the server to the second button, but I do not know how to do that.

  • I put together 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><scriptsrc="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><linkhref="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>
    
        
    asked by anonymous 19.12.2016 / 03:13

    1 answer

    1

    Solved, new library released!

    link

        
    22.12.2016 / 01:19