<div class="modal-header">
    <h3 class="modal-title">Upload</h3>
</div>
<div class="modal-body">
  <div class="form-horizontal" novalidate>
    <div class="form-group required">
      <label for="name" class="col-sm-4 control-label">Title</label>
      <div class="col-sm-6">
        <div class="input-group">
          <span class="input-group-addon"><i class="fa fa-tags fa-fw"></i></span>
          <input type="text" name="name" class="form-control" id="name" ng-model="name" required>
        </div>
          <div class="help-block" ng-messages="uploadForm.name.$error" ng-show="uploadForm.name.$touched">
            <div ng-messages-include="my-custom-messages"></div>
        </div>
      </div>
    </div>
    <div class="form-group required">
      <label for="type" class="col-sm-4 control-label">Upload type</label>
      <div class="col-sm-6">
        <div class="input-group">
          <span class="input-group-addon"><i class="fa fa-info fa-fw"></i></span>
          <select name="type" id="type" ng-model="type" class="form-control">
            <option ng-repeat="type in datatypes" value="{{type._id}}">{{type.name}}</option>
          </select>
        </div>
          <div class="help-block" ng-messages="uploadForm.type.$error" ng-show="uploadForm.type.$touched">
            <div ng-messages-include="my-custom-messages"></div>
        </div>
      </div>
    </div>
  <form name="upload_form">
    <div class="form-group required">
      <label for="file" class="col-sm-4 control-label">File</label>
      <div class="col-sm-6">
        <div class="input-group">
          <span class="input-group-addon"><i class="fa fa-file fa-fw"></i></span>
          <span class="btn btn-default btn-file">
            Browse <input
                     type="file"
                     ngf-select
                     ng-model="file"
                     name="file"
                     ngf-pattern="'image/*'"
                     accept="image/*"
                     ngf-max-size="5MB"
                   />
          </span>
        </div>
          <div class="help-block" ng-messages="uploadForm.file.$error" ng-show="uploadForm.file.$touched">
            <div ng-messages-include="my-custom-messages"></div>
        </div>
      </div>
    </div>
  </form>

  </div>

  <script type="text/ng-template" id="my-custom-messages">
    <p ng-message="maxlength">There has to be less characters.</p>
    <p ng-message="required">This field is required.</p>
    <p ng-message="email">This needs to be a valid email</p>
  </script>

</div>
<div class="modal-footer">
    <button class="btn btn-danger" type="button" ng-click="submit()">Upload</button>
    <button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
</div>
