So I am having a form and when I load the form I call a function with it. The function fills the form with some data.
$scope.fill = function {
$scope.formData.name = 'Sara';
console.log($scope.formData.name);
})
And on the index view I have the following:
<div class="form-group">
<input type="text" class="form-control" name="name" ng-model="formData.name"></div>
So when I press the the button :
<button ng-controller="formController" ui-sref="front.form.profile" ng-click="fill()">Fill</button>
I want the form about the name to be filled with the value I defined.
The problem I have is that the $scope is updated, on console.log I get the name sara but the form is still empty and does not get updated>
I added $scope.apply() in the end of the function but it does not make any change . Please help