ng-admin

ng-admin add a 'Create' button with default value based on filter


I have a list view, and a filter. Let's say the user filter by a reference object. and he see no records found, I'd like to offer him to create a new record, but to use the picked value from the filter as an initial value for the new record.

I can't figure out how, thanks


Solution

  • Continuing from @François Zaninotto answer,

    It's very simple, we just need to add this:

    default-values="search"

    inside the ma-create directive, for each view we'd like it's creation to be based on filter results.