简体   繁体   中英

Display xeditable editable form inside popup

Need to wrap the editable form inside a bootstrap uib-popover-template.

Have tried the editable ui-bootstrap popover approach, but it is not working as expected.

Plunker 1 --> https://plnkr.co/edit/vXeVoFYVU2IU08CF angular-bootstrap approach - Not able show/hide the form

Plunker 2 --> https://plnkr.co/edit/upUFeEeQbxs8VfF5?preview x-editable approach - Not able wrap it inside the popover

<div class="ui-popover-wrapper">
  <a href="#" editable-text="user.name" 
    ng-click="editableForm.$show()">{{user.name || 'empty' }}</a>
</div>

   <form editable-form name="editableForm" onaftersave="saveUser()" ng-show="editableForm.$visible">
    <div>
      <span class="title">DDown1: </span>
      <span editable-select="user.status" e-name="status" e-ng-options="s.value as s.text for s in statuses">
        {{ (statuses | filter:{value: user.status})[0].text || 'Not set' }}
      </span>
    </div>  

    
    <div>
      <!-- editable username (text with validation) -->
      <span class="title">DropDown Date: </span>
      <span editable-date="user.date" onbeforesave="checkDate($data)"
      >{{ (user.date | date: "yyyy-MM-dd") || 'empty' }}</span>
    </div> 
    
    <div>
      <!-- buttons to submit / cancel form -->
      <span ng-show="editableForm.$visible">
        <button type="submit" class="btn btn-primary" ng-disabled="editableForm.$waiting">
          Save
        </button>
        <button type="button" class="btn btn-default" ng-disabled="editableForm.$waiting" ng-click="editableForm.$cancel()">
          Cancel
        </button>
      </span>
    </div>
  </form>  

I have edited your first plunkr: https://plnkr.co/edit/QNKoOd7rZzAiIRJf

You need to pass the id of your template as a string to the bootstrap popover directive:

  uib-popover-template="'myPopoverTemplate.html'"

I also removed this from your code:

ng-show="editableForm.$visible"

I am assuming you want to show the popover on click.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM