1

FOSJSBundle を使用して角度リソースに URL を生成したい。

これは、URL を生成するために FOSJSBundle を必要とするコードです。

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

これは、リソースを使用するサービス コードです。

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

このコードは機能しますが、FOSJSBundle を使用して URL を生成したいのですが、Routing.generate が ID にアクセスできないため、このコードを実行しても機能しません。

私はこのコードを証明しましたが、動作しません:

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

私に何ができる?

ありがとう

4

0 に答える 0