cypresslab/angular-ng-routing-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

A way to expose your Symfony2 routing to Angular $resource service.

Installs: 136 603

Dependents: 0

Suggesters: 0

Security: 0

Stars: 14

Watchers: 2

Forks: 2

Open Issues: 0

Language:JavaScript

Type:symfony-bundle

0.1.5 2014-06-25 12:40 UTC

This package is auto-updated.

Last update: 2024-10-29 08:05:19 UTC


README

#AngularNgRoutingBundle

Build Status

A Symfony2 bundle to expose your routing in Angular.js resource format

This bundle depends on FOSJsRoutingBundle

##Installation

{
    "require": {
        "cypresslab/angular-ng-routing-bundle": "~1.0@dev"
    }
}

and enable the bundle in the kernel. Remember to publish assets with:

$ php app/console assets:install --symlink web #change this to your requirements

##Usage

Follow the docs of FOSJsRoutingBundle

You will add, at some point in your views, something like:

<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>

Just add these two more lines

<script src="{{ asset('bundles/cypressangularngrouting/ng-router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', {"callback": "cypress.NgRouter.setData"}) }}"></script>

This will register in the global namespace an object named NgRouting

You can use it like this:

var url = NgRouting.generateResourceUrl('api_saves_get_documents');
// url now is something like: /app_dev.php/saves/:id
var resource = $resource(url, { id: 2 }, { 'create': { method: 'PUT' } })