lundi 17 octobre 2016

Why angularjs error response prints the laravel error with square bracket and double quote?

I'm trying to print the laravel error through angularjs, i have done but there is problem inside the code. Script is also showing square bracket and double quote.

Validation in Controller

$this->validate($request, [
    'email' => 'required|email',
]);

In AngularJs

request.error(function (error) {
    $scope.mError = error.email;
    $scope.loader=false;
});

In HTML

<div class="err" ng-if="mError">@</div>

**OutPut**
["The email must be a valid email address."]

Can anyone guide me how can i prevent to print the double quotes and square brackets with error? I would like to appreciate. Thank You



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire