To retrieve the value of 'foo' in your template file, where the form name attribute is set to 'foo', use the following syntax:
foo.$valid
If you need to access this in your controller javascript file, you can do so by using:
$scope.foo.$valid
Here is an example code template for reference:
In your HTML file::
<form name="form.name"></form>
In your controller javascript file::
$scope.form = {};
$scope.form.name = "foo";
$timeout(function(){
console.log($scope.foo.$valid)
}, 1);
In the code above, I have used a timeout function to log the validity of the form. Remember that trying to access the form before AngularJS has compiled it will result in undefined. Ensure that your HTML file is compiled before using the form variable.