<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Force Selection in Angular Material Autocomplete	</title>
	<atom:link href="https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete/feed" rel="self" type="application/rss+xml" />
	<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete</link>
	<description>onthecode blog</description>
	<lastBuildDate>Wed, 09 Feb 2022 15:41:47 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.3</generator>
	<item>
		<title>
		By: abhilash wankhade		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-5608</link>

		<dc:creator><![CDATA[abhilash wankhade]]></dc:creator>
		<pubDate>Tue, 30 Mar 2021 06:35:52 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-5608</guid>

					<description><![CDATA[well my auto complete is dynamic and I am getting data from database so following part is giving error.
Could you tell me how to deal with it.

displayWith(obj?: any): string &#124; undefined {
      return obj ? obj.name : undefined;
    }]]></description>
			<content:encoded><![CDATA[<p>well my auto complete is dynamic and I am getting data from database so following part is giving error.<br />
Could you tell me how to deal with it.</p>
<p>displayWith(obj?: any): string | undefined {<br />
      return obj ? obj.name : undefined;<br />
    }</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ปั้มไลค์		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-4853</link>

		<dc:creator><![CDATA[ปั้มไลค์]]></dc:creator>
		<pubDate>Sat, 18 Jul 2020 09:02:04 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-4853</guid>

					<description><![CDATA[Like!! Great article post.Really thank you! Really Cool.]]></description>
			<content:encoded><![CDATA[<p>Like!! Great article post.Really thank you! Really Cool.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Netaji		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-4076</link>

		<dc:creator><![CDATA[Netaji]]></dc:creator>
		<pubDate>Mon, 25 May 2020 21:38:25 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-4076</guid>

					<description><![CDATA[https://stackblitz.com/edit/angular-hph5yz

This solved my problem. It includes filtering too.]]></description>
			<content:encoded><![CDATA[<p><a href="https://stackblitz.com/edit/angular-hph5yz" rel="nofollow ugc">https://stackblitz.com/edit/angular-hph5yz</a></p>
<p>This solved my problem. It includes filtering too.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Netaji		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-4075</link>

		<dc:creator><![CDATA[Netaji]]></dc:creator>
		<pubDate>Mon, 25 May 2020 20:56:24 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-4075</guid>

					<description><![CDATA[Basically I am checking for a filter feature enabled with this approach, could you please do the needful, Thanks.]]></description>
			<content:encoded><![CDATA[<p>Basically I am checking for a filter feature enabled with this approach, could you please do the needful, Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Netaji		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-4074</link>

		<dc:creator><![CDATA[Netaji]]></dc:creator>
		<pubDate>Mon, 25 May 2020 19:49:16 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-4074</guid>

					<description><![CDATA[This works well. Thanks! 

I&#039;ve a problem though, with the given example the Autocomplete is loaded well but is not searchable. To make it searchable I&#039;ve tried using [formControl] on top of existing code as below and the list just doesn&#039;t load at all, what am I missing?

Template:

          

          
            
              {{skillItem.name}}
            
          

          
            Please enter a value
          
          
            Please select a valid skill
          


Component:

this.form = new FormGroup({
      skill: new FormControl(&#039;&#039;, [Validators.required, this.RequireMatch]),
});

this.filteredSkillData = this.skillMatAutocompleteControl.valueChanges
 .pipe(
  startWith(null),
  map(name =&#062; name ? this._filter(name) : this.skillData.slice())
);

private _filter(value: any): Skill[] {
  value = (value &#038;&#038; typeof value === &#039;string&#039;) ? value : value.name;
  const filterValue = value.toLowerCase();
  return this.skillData.filter(skill =&#062; skill.name.toLowerCase().includes(filterValue));
}]]></description>
			<content:encoded><![CDATA[<p>This works well. Thanks! </p>
<p>I&#8217;ve a problem though, with the given example the Autocomplete is loaded well but is not searchable. To make it searchable I&#8217;ve tried using [formControl] on top of existing code as below and the list just doesn&#8217;t load at all, what am I missing?</p>
<p>Template:</p>
<p>              {{skillItem.name}}</p>
<p>            Please enter a value</p>
<p>            Please select a valid skill</p>
<p>Component:</p>
<p>this.form = new FormGroup({<br />
      skill: new FormControl(&#8221;, [Validators.required, this.RequireMatch]),<br />
});</p>
<p>this.filteredSkillData = this.skillMatAutocompleteControl.valueChanges<br />
 .pipe(<br />
  startWith(null),<br />
  map(name =&gt; name ? this._filter(name) : this.skillData.slice())<br />
);</p>
<p>private _filter(value: any): Skill[] {<br />
  value = (value &amp;&amp; typeof value === &#8216;string&#8217;) ? value : value.name;<br />
  const filterValue = value.toLowerCase();<br />
  return this.skillData.filter(skill =&gt; skill.name.toLowerCase().includes(filterValue));<br />
}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Umut Esen		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-1381</link>

		<dc:creator><![CDATA[Umut Esen]]></dc:creator>
		<pubDate>Thu, 20 Feb 2020 00:08:08 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-1381</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-1233&quot;&gt;harsh&lt;/a&gt;.

Hi, do you see any errors in the console (hit F12 to see)? Also, make sure the control key matches your form control defined in the component.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-1233">harsh</a>.</p>
<p>Hi, do you see any errors in the console (hit F12 to see)? Also, make sure the control key matches your form control defined in the component.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: harsh		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-1233</link>

		<dc:creator><![CDATA[harsh]]></dc:creator>
		<pubDate>Tue, 31 Dec 2019 12:16:24 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-1233</guid>

					<description><![CDATA[while submit form i am not getting required error]]></description>
			<content:encoded><![CDATA[<p>while submit form i am not getting required error</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Randy		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-373</link>

		<dc:creator><![CDATA[Randy]]></dc:creator>
		<pubDate>Thu, 24 Oct 2019 12:27:54 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-373</guid>

					<description><![CDATA[How can I apply an Angular Material Autocomplete Force Selection solution using template-driven forms?]]></description>
			<content:encoded><![CDATA[<p>How can I apply an Angular Material Autocomplete Force Selection solution using template-driven forms?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Ruben Heymans		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-258</link>

		<dc:creator><![CDATA[Ruben Heymans]]></dc:creator>
		<pubDate>Sat, 05 Oct 2019 12:35:12 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-258</guid>

					<description><![CDATA[Thanks for this easy solution!
It would also be nice to match on an object of type x instead of just object.
Also do you know how how to match the data with and id of an object and not entire object? I save the id&#039;s in my database.]]></description>
			<content:encoded><![CDATA[<p>Thanks for this easy solution!<br />
It would also be nice to match on an object of type x instead of just object.<br />
Also do you know how how to match the data with and id of an object and not entire object? I save the id&#8217;s in my database.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Umut Esen		</title>
		<link>https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-108</link>

		<dc:creator><![CDATA[Umut Esen]]></dc:creator>
		<pubDate>Mon, 29 Jul 2019 08:12:20 +0000</pubDate>
		<guid isPermaLink="false">https://onthecode.co.uk/?p=1018#comment-108</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-52&quot;&gt;Ankur&lt;/a&gt;.

Hi Ankur, thank you for your comment. What error message are you getting?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://onthecode.co.uk/blog/force-selection-angular-material-autocomplete#comment-52">Ankur</a>.</p>
<p>Hi Ankur, thank you for your comment. What error message are you getting?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
