Hi I have a problem in laravel 5 existing validation.
In my controller and request.
class PostEmailRequest extends Request{
/**
 * Get the validation rules that apply to the request.
 *
 * @return array
 */
public function rules()
{
    return [
        'email' => 'required|max:255',
    ];
}}
It will return the validation of an email as an example. What I want to do with my angularjs is I want to catch validation and fetch it on my front-end form. It will not reload the page. Do you have any idea about this one?
Form from my application will send data through angularjs. $http post url "app/postPage" and if it has an error above my code will $validation->messages() will send to my angularjs.
You can do following.
POST route for validation lets say myapp.com/validateEmail$http request of anuglarJS. Lets say
Email
Read this JSON in scope model in angularjs controller. In the success() of following code.
$http.post('/someUrl', {msg:'hello word!'}).
  success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
 }).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
Show appropriate error based on scope in HTML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With