Can not fetch the value from array using Angular.js
<p>I need one help.I am unable to fetch some value as per some condition using angular.js.I am explaining my code below.</p>

<pre><code> var subcategories = [{
            id:1,
            name: 'SubCategory 1',
            value: 1
          }, {
            id:2,
            name: 'SubCategory 2',
            value: 2
          }, {
            id:3,
            name: 'SubCategory 3',
            value: 3
          }, {
            id:4,
            name: 'SubCategory 4',
            value: 4
          }];
    var result = $filter('filter')(subcategories, {id:1})[0];
    console.log('result',result);
</code></pre>

<p>Here i need to fetch all data whose <code>id=1</code> from <code>subcategories</code> object. But in console i am getting result <code>undefined</code>. Please help me. </p>