Provides AngularJS support for FOSJsRoutingBundle.
Include main script in your html
<script type="text/javascript" src="path/to/angular-fosjsrouting/angular-fosjsrouting.min.js"></script>
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.
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>
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);
});