ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Assign Filter output to Variable in AngularJS<p>Hi&nbsp;rani,</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <div class="demo_block"> <pre class="brush: html">&lt;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&gt; &lt;head&gt; &lt;title&gt;Assign filter output to variables&lt;/title&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.8/angular.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#34;MyApp&#34;, []); app.controller(&#34;MyController&#34;, function ($scope) { $scope.Customers = [ { Id: 1, Name: &#34;John Hammond&#34;, Country: &#34;United States&#34; }, { Id: 2, Name: &#34;Mudassar Khan&#34;, Country: &#34;India&#34; }, { Id: 3, Name: &#34;Suzanne Mathews&#34;, Country: &#34;France&#34; }, { Id: 4, Name: &#34;Robert Schidner&#34;, Country: &#34;Russia&#34; } ]; }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div ng-app=&#34;MyApp&#34; ng-controller=&#34;MyController&#34;&gt; Enter Name : &lt;input ng-model=&#34;search&#34; type=&#34;text&#34; placeholder=&#34;Enter name&#34; /&gt; &lt;hr /&gt; &lt;table border=&#34;1&#34; cellpadding=&#34;0&#34; cellspacing=&#34;0&#34;&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Id&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Country&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody ng-repeat=&#34;customer in customerVariable = (Customers | filter:search)&#34;&gt; &lt;tr&gt; &lt;td&gt;{{customer.Id }}&lt;/td&gt; &lt;td&gt;{{customer.Name }}&lt;/td&gt; &lt;td&gt;{{customer.Country }}&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;hr /&gt; &lt;h3&gt;Resutls from filtered variable.&lt;/h3&gt; &lt;table border=&#34;1&#34; cellpadding=&#34;0&#34; cellspacing=&#34;0&#34;&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Id&lt;/th&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Country&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody ng-repeat=&#34;customer in customerVariable&#34;&gt; &lt;tr&gt; &lt;td&gt;{{customer.Id }}&lt;/td&gt; &lt;td&gt;{{customer.Name }}&lt;/td&gt; &lt;td&gt;{{customer.Country }}&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/445835/Assign-Filter-output-to-Variable-in-AngularJS/https://www.aspforums.net:443/Threads/445835/Assign-Filter-output-to-Variable-in-AngularJS/Fri, 10 May 2019 01:43:28 GMT