We have a form on submission of which we show a modal dialog. The modal also contains a form, whose values i am trying to retrieve.
I can get the value using ng-model, but in case of validation failure, it returns undefined. In those cases I am trying to get the value by using $viewValue like
$scope.formName.fieldName.$viewValue
This works on the main page, but in the modal i am getting an error
Cannot read property 'fieldName' of undefined
i am using angular-ui-bootstrap for the modal.
jsfiddle : http://jsfiddle.net/agadbnLr/2/
Why i am not able to get the field value in the modal using $viewValue, whereas it is possible to get the field value which directly in the page.