Error: [filter:notarray] Expected array but received
<p>I know this has been answered previously, but none of those solutions are working for me. Can some one please help me with the error below?</p>

<p>I am getting an error using <strong>Ng-Repeat</strong> with <strong>Custom filters</strong> when I am not getting an Array.</p>

<p>Can anyone help me to comeup with controller to use ng-repeat which will handle for both JSONObject and JSONArray</p>

<p>HTML Code</p>

<pre><code>&lt;td class="features" ng-show="list.Body.WorkOrder.OrderStatus.length &gt; 0"&gt;
&lt;span ng-repeat="indi in list.Body.Services.ServiceChanges.ServiceDisconnects.Service | filterWithOr:{_serviceID:['SS001','ST099','SS018']} "&gt;{{indi._serviceID}},{{indi.EPCServiceDef.EPCProduct._pn}}&lt;br&gt;&lt;/span&gt;
&lt;/td&gt;
</code></pre>

<p><strong>Error Will Produce when I have ServiceDisconnects section as below</strong></p>

<pre><code> "ServiceDisconnects": {
  "Service": {
    "-serviceID": "ST099",
    "ServiceChangeActivity": "Disconnect",
    "TelephoneNumbers": {
      "TN": "                    "
    },
    "Rate": "0.00",
    "Desc": "Xhnoecosvr",
    "Count": "0",
    "LOB": "Other",
    "PackageCode": "ST099   ",
    "EPCServiceDef": {
      "EPCProduct": {
        "-pn": "10400138",
        "Name": "EcoSaver Opt-Out Tracking",
        "LongDescription": "NO ECOSAVER TRACKING",
        "Type": "Feature",
        "LOB": "Video"
      }
    },
    "CSGServiceIdentifier": "5"
  }
}
</code></pre>

<p>But the same thing will work when the ServiceDisconnects section has multiple Service Arrays. </p>

<p>Here is the Custom Filter</p>

<pre><code>app.filter('filterWithOr', function($filter) {
    var comparator = function(actual, expected) {
        if (angular.isUndefined(actual)) {
            // No substring matching against `undefined`
            return false;
        }
        if ((actual === null) || (expected === null)) {
            // No substring matching against `null`; only match against `null`
            return actual === expected;
        }
        if ((angular.isObject(expected) &amp;&amp; !angular.isArray(expected)) || (angular.isObject(actual) &amp;&amp; !hasCustomToString(actual))) {
            // Should not compare primitives against objects, unless they have custom `toString` method
            return false;
        }

        actual = angular.lowercase('' + actual);
        if (angular.isArray(expected)) {
            var match = false;
            expected.forEach(function(e) {
                e = angular.lowercase('' + e);
                if (actual.indexOf(e) !== -1) {
                    match = true;
                }
            });
            return match;
        } else {
            expected = angular.lowercase('' + expected);
            return actual.indexOf(expected) !== -1;
        }
    };
    return function(campaigns, filters) {
        return $filter('filter')(campaigns, filters, comparator);
    };
});
</code></pre>