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.Set default selected value in select DropDownList in AngularJS <p>Hi <a class="username" rel="mahesh213"> mahesh213</a>,</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;&lt;/title&gt; &lt;link rel=&#34;stylesheet&#34; href=&#34;https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css&#34; /&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; var app = angular.module(&#39;MyApp&#39;, []); app.controller(&#39;MyController&#39;, [&#39;$scope&#39;, &#39;$http&#39;, function ($scope, $http, $timeout) { GetItems(); // Setting default item. $scope.Item = 0; function GetItems() { $scope.Items = [{ Id: 1, Name: &#39;Name 1&#39; }, { Id: 2, Name: &#39;Name 2&#39; }, { Id: 3, Name: &#39;Name 3&#39; }, { Id: 4, Name: &#39;Name 4&#39; }, { Id: 5, Name: &#39;Name 5&#39;}]; // Adding All option. $scope.Items.splice(0, 0, { Id: 0, Name: &#39;All&#39; }); } } ]); &lt;/script&gt; &lt;/head&gt; &lt;body ng-app=&#34;MyApp&#34; ng-controller=&#34;MyController&#34;&gt; &lt;div class=&#34;form-horizontal&#34;&gt; &lt;div class=&#34;form-group&#34;&gt; &lt;label for=&#34;ID&#34; class=&#34;control-label col-xs-2&#34;&gt;Item&lt;/label&gt; &lt;div class=&#34;col-md-2&#34;&gt; &lt;select style=&#34;display: inline&#34; data-ng-model=&#34;Item&#34; class=&#34;form-control&#34; data-ng-options=&#34;p.Id as p.Name for p in Items&#34;&gt; &lt;option value=&#34;&#34;&gt;-- Select Item --&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div&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/977762/Set-default-selected-value-in-select-DropDownList-in-AngularJS/https://www.aspforums.net:443/Threads/977762/Set-default-selected-value-in-select-DropDownList-in-AngularJS/Tue, 20 Aug 2019 05:20:28 GMT