I have a Angular controller that have a FormData scope, e.g: $scope.FormData. Data is collected via model connected to a simple form. Also, I have an external non-angular js code on the page. I need to push one of its variables to $scope.FormData.name. How can I do that? Already tried acces it as a global variable via $window, but no luck. Here is the example code:
Angular code:
app.controller('mainController', function ($scope, $http) {
$scope.formData = {};
$scope.formData.day = "1";
$scope.formData.month = "January"; ...
And non-angular code:
var data = [{data1: value1}, {data2:value2}];
Binding this data to a model in a form is not a good option, because this is an object, so, I will get a string in a formData, like [Object, Object].