Deep property filtering inside ng-repeat

Something that I’ll likely need to remember how to do in future is filtering a list by an element’s property. This can be taken further by filtering by that property’s property and so on.

 <div ng-repeat=”prescription in orderData.prescriptions | filter: {patient: { id: selectedPatient.patient.id}}”>

Just a matter of creating an inline JSON object that reflects the path to the relevant property. Much simpler than expected.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s