How to update $Scope.items using xeditable within form

Asked

Viewed 51 times

0

In this example it is possible to update the value of the field by clicking the confirmation button, however in my form there is no such button. What should I do to update this item/field?

My Jsfiddle form: http://jsfiddle.net/NfPcH/19435/

HTML:

<h4>Angular-xeditable Text (Bootstrap 3)</h4>
<form ng-app="app" ng-controller="Ctrl" editable-form>
  <a href="#" ng-click="$form.$show();" e-ng-blur="$form.$hide();" editable-text="user.name">{{ user.name || 'empty' }}</a>
</form>

Javascript:

var app = angular.module("app", ["xeditable"]);

app.run(function(editableOptions) {
  editableOptions.theme = 'bs3';
});

app.controller('Ctrl', function($scope) {
  $scope.user = {
    name: 'awesome user'
  };
});

1 answer

0


Solution: http://jsfiddle.net/NfPcH/19443/

HTML:

<h4>Angular-xeditable Text (Bootstrap 3)</h4>
<form ng-app="app" ng-controller="Ctrl" editable-form name="formulario">
  <a href="#" ng-click="formulario.$show()" ng-show="!formulario.$visible" editable-text="user.name">{{ user.name || 'empty' }}</a>
    <div class="buttons">
      <!-- buttons to submit / cancel form -->
      <span ng-show="formulario.$visible">
        <br/>
        <button type="submit" class="btn btn-primary" ng-disabled="formulario.$waiting">
          Save
        </button>
        <button type="button" class="btn btn-default" ng-disabled="formulario.$waiting" ng-click="formulario.$cancel()">
          Cancel
        </button>
      </span>
    </div>
</form>

Browser other questions tagged

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