hi 
i need to validate the json schema in angular js 
i had crossed half mile by displaying the schema into the html and it 
working asap 
now i need to validate the schema that means the input entered into the 
form 
 i had gone through schemaform.io and github but didnt get clear idea 
help me out the sort my issues


myApp.controller('appController', ['$scope','$http', function($scope, $http) {
    var NUMBER_REGEXP = /^[0-9]+$/;

    $http({ method: 'GET', url: 'JsonSchema.json' })
        .then(function successCallback(response) {
            $scope.data = angular.fromJson(response);
            $scope.data = $scope.data.data;
            console.log($scope.data);
        }
        );
    $scope.greeting = 'success!';

}]);
$scope.handleErrors = function (data)
{
    if(data !== undefined && data !== null){
        angular.forEach(data, function(value, key){

            var form = value.form.field;
            var fields = value.fields.field;
            var error = form.errors;
            if(form.compulsory)
            {
                $scope.pageError = form.errors.compulsory;

            }else if(!(NUMBER_REGEXP.test(filds.field)))
            {

                $scope.pageError = error.regex;

            }else {
                $scope.pageError = "An unexpected error has occurred, please 
try again later!";
            }
        });
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to