AngularJS Scope Add value to a model


I am working a submit form and I have a hidden input field. I want to set the value with AngularJS, however it will be sent with the form, so it looks like this:

<input type="hidden" ng-model="formData.articleId">

How exactly can I put a value to it with AngularJS? I tried adding ng-value="article._id" to it which added a value field with the id of the article, but it did not parse on submit.

I also tried grabbing this model with AngularJS, but again it did not work:

$scope.formData.articleId = data.article._id;

It said: Can not find articleId of undefined

Am I using a wrong approach?


$scope.formData = { articleId: data.article._id };