I am trying to create an angular directive to behave the same as this jsfiddle that is done in jquery.
The purpose of the directive is to have the controller (parent) scope have a value of width, and have the directive display that value as a textbox and a fraction select list, but only storing the width as a value, not a whole number and a fraction. Here is my attempt that has it partially working, but I can't get it to update the directive model values when changing the parent value.
In the fiddle you can see my commented out lines where I thought that I could add a watch to the width but this doesn't seem to work.
$scope.$watch('value', function(val){
if(val && val !== '' && parseInt(val) !== 0){
// $scope.wholeAmount = parseInt($scope.value);
// $scope.fraction = getFraction($scope.value % 1);
// }
//});
In the angular directive example it doesn't update the whole number and fraction when changing the textbox unlike how the jquery fiddle works.
Any help would be greatly appreciated.
Update Working Solution