Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want genereate url in angular resource using FOSJSBundle.

This is the code that need FOSJSBundle to generate url:

Routing.generate('get_constructionprivateinformation_industrialists', {id: id}, false));

This is the service code that use resource:

services.factory('IndustrialistsFactory', function ($resource) {
    return $resource(
        '/app.php/api/v1/constructionprivateinformations/:id/industrialists',
        {id: '@id'},
        {
            query: { method: 'GET', isArray: true },
            create: { method: 'POST'}
        }
    )
});

This code works but I want generate url using FOSJSBundle, then If I do this code not works because Routing.generate have not access to id.

I proved this code but not works:

services.factory('IndustrialistsFactory', function ($resource) {
    return $resource(
        Routing.generate('get_constructionprivateinformation_industrialists', {id: id}),
        {id: '@id'},
        {
            query: { method: 'GET', isArray: true },
            create: { method: 'POST'}
        }
    )
});

What Can I do?

Thanks

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.