JSFiddle - React, Tailwind, and code Playground
HTML
<h1>Multi Input</h1>
<div ng-app="App">
<div ng-controller="AppCtrl">
<multi-input items="theSimpsons"/>
</div>
</div>
JavaScript
angular.module('App', []).
directive('multiInput', function() {
return {
restrict: 'E',
scope: {items:'=items'},
template:
'<div>' +
'<div ng-repeat="item in items">' +
'<input type="text" ng-model="item.value">' +
'<a ng-click="items.splice($index, 1)">remove</a>' +
'</div>' +
'<a ng-click="items.push({value:\'\'})">add</a>' +
'</div>'
};
});
function AppCtrl($scope) {
$scope.theSimpsons = [{value:'Bart'}, {value:'Lisa'}];
}