JSFiddle - React, Tailwind, and code Playground

by Lucas Silva

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-sanitize.min.js"></script>
<script src="http://vitalets.github.io/angular-xeditable/dist/js/xeditable.js"></script>
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="http://vitalets.github.io/angular-xeditable/dist/css/xeditable.css">
<h4>Angular-xeditable Text (Bootstrap 3)</h4>
<form ng-app="app" ng-controller="Ctrl" editable-form name="formulario">
  
  <!-- Texto I -->
  <a href="#" ng-click="show1()" ng-show="!form1Visible" editable-text="user.name">{{ user.name || 'empty' }}</a>
    <div class="buttons">
      <!-- buttons to submit / cancel form -->
      <span ng-show="form1Visible">
        <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="cancel1()">
          Cancel
        </button>
      </span>
    </div>
    <br />
    
    <!-- Texto II -->
    <a href="#" ng-click="show2()" ng-show="!form2Visible" editable-text="user.name">{{ user.name || 'empty' }}</a>
    <div class="buttons">
      <!-- buttons to submit / cancel form -->
      <span ng-show="form2Visible">
        <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="cancel2()">
          Cancel
        </button>
      </span>
    </div>
</form>

CSS

div[ng-app] { margin: 50px; }

JavaScript

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

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

app.controller('Ctrl', function($scope) {
  $scope.user = {
    name: 'awesome user'
  };
  $scope.form1Visible = false;
  $scope.form2Visible = false;
  
  $scope.show1 = function () {
  	$scope.form1Visible = true;
  } 
  $scope.show2 = function () {
  	$scope.form2Visible = true;
  } 
  $scope.cancel1 = function () {
  	$scope.form1Visible = false;
  }
  $scope.cancel2 = function () {
  	$scope.form2Visible = false;
  }
});