2017 © Pedro Peláez
 

symfony-bundle knockout-js-bundle

Symfony KnockoutJSBundle

image

padam87/knockout-js-bundle

Symfony KnockoutJSBundle

  • Friday, January 31, 2014
  • by Padam87
  • Repository
  • 1 Watchers
  • 6 Stars
  • 100 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

KnockoutJS Bundle

Integrates knockout.js into Symfony2, provides automatic code generation for collections., (*1)

1. Example

$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)

2. Installation

2.1. Composer:

"padam87/knockout-js-bundle": "dev-master",

2.2. AppKernel:

$bundles = array(
    ...
    new Padam87\KnockoutJSBundle\Padam87KnockoutJSBundle(),
);

2.3. config.yml:

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)

2.4. Add the js to your page.

<script src="{{ asset('bundles/padam87knockoutjs/js/knockout-2.1.0.js') }}"></script>

2.5. Create your view

{{ knockout(form.vars.knockout)|raw }}
{{ form_widget(form) }}

3. Dependencies

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)

4. Stuff to do

  • Generator. Right now the command is there, but its not working properly.

Bitdeli Badge, (*5)

The Versions

31/01 2014

dev-master

9999999-dev https://github.com/Padam87/KnockoutJSBundle

Symfony KnockoutJSBundle

  Sources   Download

by Adam Prager

javascript symfony knockoutjs mvvm