Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource.filter for substring #295

Closed
stephen-murby opened this issue Jan 16, 2015 · 4 comments
Closed

resource.filter for substring #295

stephen-murby opened this issue Jan 16, 2015 · 4 comments
Assignees

Comments

@stephen-murby
Copy link

DEFAULT_RECORDS = [{ id: 1, name: 'John Evans', number: '01928 356115' },{ id: 16, name: 'Murbinator', number: '053180 080000' }];

lookup: function (name) {
            var retrievedRecords = {};
            var _this = this;
            Record.findAll().then(function () {
                var params = {
                    where: {
                        name: {
                            'in': name
                        }
                    }
                };
                retrievedRecords = Record.filter(params);
                debugger;
                _this.lookupSuccess(retrievedRecords);
            }).catch(function (error) {
                console.log(error);
            });
        },

Where 'in': name name is "John" no record is found
Where 'in': name name is "John Evans" one record is found.
Looking at issue 238 that appears to be the way I should be filtering but is not the value I expect to be return for sub-string filtering.

angular-data : 1.5.3
angular : 1.3.8

@jmdobry
Copy link
Member

jmdobry commented Jan 16, 2015

I misspoke in that issue. You're looking for the contains operator, which is available in 2.0 (js-data-angular).

@stephen-murby
Copy link
Author

Thanks.

@jmdobry
Copy link
Member

jmdobry commented Jan 16, 2015

@stephen-murby Actually now that I take a closer look at the code, I'm not so sure the functionality you're looking for exists yet. Re-opening.

@jmdobry
Copy link
Member

jmdobry commented Feb 4, 2015

Please re-submit this issue to https://github.com/js-data/js-data/issues for discussion an implementation there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants