JSFiddle - React, Tailwind, and code Playground

by dandoyon

HTML

<script src="http://code.angularjs.org/1.0.0/angular-1.0.0.min.js"></script>
<div ng-app='myApp'>
<div ng-controller="Ctrl">
    <div ng-repeat="(i, name) in names">
        <a ng-click="edit(i)">{{name}}</a>
    </div>
        
    <input type='text' ng-model='names[editIndex]'/>
</div>
</div>

CSS

.click2edit:hover{color:red;cursor:pointer;}

JavaScript

var myApp = angular.module('myApp',[]);

function Ctrl($scope){
    $scope.names = ['homer', 'marge'];
    
    $scope.editIndex = 0;
    $scope.edit = function(i) { $scope.editIndex = i; }
    
        
    
}