dev-master
9999999-dev https://github.com/Padam87/KnockoutJSBundleSymfony KnockoutJSBundle
by Adam Prager
javascript symfony knockoutjs mvvm
Symfony KnockoutJSBundle
Integrates knockout.js into Symfony2, provides automatic code generation for collections., (*1)
$builder ->add('items', 'knockout', array( 'type' => new OrderItemType(), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false, )) ;
I have added the items field with the KnockoutType, which extends the CollectionType, and handled the same way as a collection., (*2)
"padam87/knockout-js-bundle": "dev-master",
$bundles = array( ... new Padam87\KnockoutJSBundle\Padam87KnockoutJSBundle(), );
imports: ... - { resource: "@Padam87KnockoutJSBundle/Resources/config/config.yml" } jms_di_extra: locations: all_bundles: false bundles: [Padam87KnockoutJSBundle]
jms_di_extra configuration is unnecessary if you have set all_bundles to true, (*3)
<script src="{{ asset('bundles/padam87knockoutjs/js/knockout-2.1.0.js') }}"></script>
{{ knockout(form.vars.knockout)|raw }} {{ form_widget(form) }}
None. For testing purposes I used my BaseBundle, if you want to test it, you have to include it in your composer.json file too., (*4)
Symfony KnockoutJSBundle
javascript symfony knockoutjs mvvm