How to get selected button values into text box ? if i change text in input box, have to bind that text to the button value .. i have a code solved with jquery, but how to solve this with angularjs?? JSBin Link to Edit
AngularJS
var app = angular.module('myapp', []);
app.controller('MainCtrl', function($scope) {
//Code goes here//
});
<!DOCTYPE html>
<html ng-app="myapp">
<head>
<script src="https://code.angularjs.org/1.4.8/angular.js"></script>
</head>
<body ng-controller="MainCtrl">
<div>
<button>Feed</button>
<button>the</button>
<button>Input</button>
</div>
<input type="text" value="click a button">
</body>
</html>
Solved with jQuery
var actualButton;
$( "button" ).click(function() {
actualButton = $(this);
var text = $( this ).text();
$( "input" ).val( text );
});
$("input").on('keyup', function(e){
if(actualButton === undefined)
return;
actualButton.text($(this).val());
});