bower-angular-fosjsrouting

AngularJS support for FriendsOfSymfony Javascript routing module.

Angular Core Dependency: *

Module License: MIT

Added by: Sam Deering

GitHub

Repository

draco1989/bower-angular-fosjsrouting

Stats

Stars: 4

Watchers: 4

Forks: 0

Author

Draco1989
Draco1989

Module Description

Angular-FosJSRouting

Provides AngularJS support for FOSJsRoutingBundle.

Installation

Include main script in your html

<script type="text/javascript" src="path/to/angular-fosjsrouting/angular-fosjsrouting.min.js"></script>

Usage

Import fosjsrouting in your angular module.

    angular.module('MyModule', ['fosjsrouting']);

Configure it throught $routingProvider

    angular.module('MyModule', ['fosjsrouting']).
            config(function ($routingProvider) {
                $routingProvider.setDefaultParams({
                    '%user_id%': 3
                });
            });

This package includes AngularJS configurable filter and service/provider.

Filter

To generate a simple path

    <a href="{{ 'my_symfony_path_name'|routing }}">Go home</a>

To generate a path with parameters

    <a href="{{ 'hello_user_path_name'|routing:{'%user%':'David'} }}">Go home</a>

To generate an absolute path with parameters

    <a href="{{ 'hello_user_path_name'|routing:{'%user%':'David'}:true }}">Go home</a>

Service

To generate a simple path

    angular.module('MyModule', ['fosjsrouting']).
            controller('Ctrl', function ($scope, $routing) {
                $scope.path = $routing.generate('my_symfony_path_name');
            });

To generate a path with parameters

    angular.module('MyModule', ['fosjsrouting']).
            controller('Ctrl', function ($scope, $routing) {
                $scope.path = $routing.generate('hello_user_path_name', {'%user%': 'David'});
            });

To generate an absolute path with parameters

    angular.module('MyModule', ['fosjsrouting']).
            controller('Ctrl', function ($scope, $routing) {
                $scope.path = $routing.generate('hello_user_path_name', {'%user%': 'David'}, true);
            });

Module stats last updated: 2015-06-04 11:09:23

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!