legionofmyown/angsym-forms

Symfony2 forms presentation and handling with Angular.js

1.0.0 2015-10-05 13:07 UTC

This package is not auto-updated.

Last update: 2024-04-17 15:48:31 UTC


README

Symfony2 bundle to expose forms for Angular.js interface and process AJAX submits.

Usage

Controller

/**
 * @Route("/")
 * @Template()
 */
public function indexAction()
{
    return [
        'formName' => Form1::class
    ];
}

/**
 * @Route("/test-form-1", name="test_form1")
 * @Template()
 */
public function testForm1Action(Request $request)
{
    $response = $this->get('angsym.form')->processForm($request, Form1::class, TestEntity::class);

    return $response;
}

Twig

{{ angsym_form('myAppTest', formName, path("test_form1"), 'POST' ) }}