Skip to content

Instantly share code, notes, and snippets.

@awkale
Last active April 13, 2018 23:04
Show Gist options
  • Save awkale/52ca7e8ed175af78ae816b5b591a8d2a to your computer and use it in GitHub Desktop.
Save awkale/52ca7e8ed175af78ae816b5b591a8d2a to your computer and use it in GitHub Desktop.
angular cheatsheet #angularjs #cheatsheet
// find an object in an array based on object property
var objArray = [
{ id: 0, name: 'Object 0', otherProp: '321' },
{ id: 1, name: 'O1', otherProp: '648' },
{ id: 2, name: 'Another Object', otherProp: '850' },
{ id: 3, name: 'Almost There', otherProp: '046' },
{ id: 4, name: 'Last Obj', otherProp: '984' }
];
$filter('filter')(objArray, {id: 3}, true)[0];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment