I am very much new in angular js.I want to validate and post the form data using angular js on submit.I searched google but most of them was disable the button on load ,after completing the form with valid data the button enable but I want to show error messages on form submit.

I have tested with two text fields one is name and other is email but I want to proper messages for each fields e.g for email,phone no (valid format) and empty fields now I get only empty field message.
<span class="error-message"
ng-show="showMessage(frmReg.name)">
Please complete this field.</span>
var app=angular.module('regForm',[]);
app.controller('FormController',function($scope,$http){
$scope.frmRegField={};
$scope.frmSubmit=function(){
angular.forEach($scope.frmReg.$error.required, function(field) {
field.$setDirty();
});
// $http({
// method:"POST",
// url:"form_submit.php",
// data:$scope.frmRegField
// }).success(function(data){
// });
};
$scope.showMessage=function(input){
console.log(input.$$attr.name);
var show = input.$invalid && (input.$dirty || input.$touched);
return show;
};
});
You could use either class or state to do what you need
Input fields have the following states:
$untouchedThe field has not been touched yet$touchedThe field has been touched$pristineThe field has not been modified yet$dirty Thefield has been modified$invalidThe field content is not valid$validThe field content is validThey are all properties of the input field, and are either true or false.
Forms have the following states:
$pristineNo fields have been modified yet$dirtyOne or more have been modified$invalidThe form content is not valid$validThe form content is valid$submittedThe form is submittedThe following classes are added to, or removed from, input fields:
ng-untouchedThe field has not been touched yetng-touchedThe field has been touchedng-pristineThe field has not been modified yetng-dirtyThe field has been modifiedng-validThe field content is validng-invalidThe field content is not validng-valid-keyOne key for each validation. Example:ng-valid-required, useful when there are more than one thing that must be validatedng-invalid-keyExample:ng-invalid-requiredThe following classes are added to, or removed from, forms:
ng-pristineNo fields has not been modified yetng-dirtyOne or more fields has been modifiedng-validThe form content is validng-invalidThe form content is not validng-valid-keyOne key for each validation. Example:ng-valid-required, useful when there are more than one thing that must be validatedng-invalid-keyExample:ng-invalid-requiredThe classes are removed if the value they represent is
false.Give the form a name:
And a name for the input to:
Then use ng-show/ng-if in your span:
You can use ng-disabled to validate submit too:
Hope this helps. Good luck!