So I was about to post quite a lengthy question asking how I could bind a $scope variable with a dynamically generated form which also accesses said $scope variable.
e.g. $scope.inputVariable
I just couldn’t get it to work, hell even when writing console.log($scope.inputVariable) it wouldn’t actually show what was within the text input.
The solution I’ve used before which worked in this instance too was to encapsulate inputVariable in a data object
$scope.data = {
inputVariable: 'wooples'
};
as soon as I did this everything started working as expected. I’m sure there’s a reason for this, but can anyone point me in the direction of, or tell me, why angular seems to handle data within objects better than data directly in the scope?
Ta!