【问题标题】:NG-Admin: Is there a way to create an "add new" button on a referenced_list?NG-Admin:有没有办法在 referenced_list 上创建一个“添加新”按钮?
【发布时间】:2015-08-27 10:35:03
【问题描述】:

我的 ng-admin 应用中有一个 referenced_list:

nga.field('profiles', 'referenced_list') // display list of related profiles
                .targetEntity(profiles) 
                .targetReferenceField('user_id')
                .targetFields([
                    nga.field('id').isDetailLink(true),
                    nga.field('username'),
                ]),
            nga.field('', 'template').label('')
                .template('<span class="pull-right"><ma-filtered-list-button entity-name="profiles" filter="{ user_id: entry.values.id }" size="sm"></ma-filtered-list-button></span>')

模板字段创建一个“查看所有相关配置文件”链接。

我想做的是创建一个链接到配置文件创建页面的“添加新配置文件”按钮,并预先选择当前的 user_id。

是否有 hack 可以做到这一点或自定义模板/指令可以做到这一点?

【问题讨论】:

    标签: angularjs ng-admin


    【解决方案1】:

    &lt;ma-create-button&gt;directive 已在几天前添加 (https://github.com/marmelab/ng-admin/pull/696)。它完全可以满足您的需求:

    <ma-create-button entity-name="comments" default-values="{ post_id: entry.values.id }" size="xs"></ma-create-button>

    在 ng-admin 0.9-dev 及更高版本中可用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 2021-01-25
      • 2019-09-22
      • 2011-03-04
      相关资源
      最近更新 更多