Skip to content

Filter by substring #238

Closed
Closed
@AlJohri

Description

@AlJohri

I read through the client side filtering code here https://github.com/jmdobry/angular-data/blob/master/src/datastore/index.js#L12 and can't find any option that allows for filtering by substring.

I request data from my api that contains a substring like so:
Listing.findAll({message__contains: "bike"});
and I would like to get this data again via angular-data's filter.

var listings = Listing.filter({ where: {message:{'__something__':'bike'}} });

where __something__ would check listing.message.indexOf(parameter).

Is something like this within the purview of this project?


As a temporarily alternative I see your solution here: #76 (comment) but would like to find a better solution.

EDIT: just read the alternative more carefully - it seems as though its still not possible to do what I'd like

If you have no control over the how the server handles the params sent by findAll, then angular-data provides the implementable queryTransform function. In addition, you can override the function that filter uses internally to figure out how to pull the correct subset out of the data store.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions