TLDR; I don't want to databind two input boxes, but rather pass the variable from the controller to the directive (which has a controller inside).
Currently I have the following
- HTML page
- HTML template
- Javascript page (controller/directive)
I inject the template into the HTML page using a directive in the JS page.
Here in the HTML page I have a button next to an input box
INITIAL AMOUNT : <input type="text" class="text-right" ng-model="initialAmount">
<button ng-click="clicked()" class="btn btn-success btn-lg" style="margin: 5px;">Add Amount</button>
When I click the button I want the text in the input box (initialAmount) to be transferred to another input box I create in the directive (from the template).
I have tried using $scope.displayArea = $scope.$parent.initialAmount;
in the directive although the problem is that this is set when the page loads not when the button is clicked.
I have also tried using the scope in the directive but that hasn't worked.
Inside of my directive is a controller that holds all the functions that it carries out.
Thanks heaps!
<>