<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Angualr on</title><link>https://tonny0531.github.io/tags/angualr/</link><description>Recent content in Angualr on</description><generator>Hugo -- gohugo.io</generator><lastBuildDate>Tue, 01 Aug 2023 14:40:21 +0900</lastBuildDate><atom:link href="https://tonny0531.github.io/tags/angualr/index.xml" rel="self" type="application/rss+xml"/><item><title>InputkeyEvent</title><link>https://tonny0531.github.io/post/angular/inputkeyevent/</link><pubDate>Tue, 01 Aug 2023 14:40:21 +0900</pubDate><guid>https://tonny0531.github.io/post/angular/inputkeyevent/</guid><description>Introduction I always forget how can i listen input event. So I write this post.
Listening Event With out Angular With out Angular framework we have to use javascript to bind event like this code
&amp;lt;input type=&amp;#34;text&amp;#34; id=&amp;#34;myInput&amp;#34;&amp;gt; document.getElementById(&amp;#39;myInput&amp;#39;).addEventListener(&amp;#39;keyup&amp;#39;, myInput); function myInput(input) { console.log(input.keyCode); } EventList
KeyCodeRef
SourceCode
With Angular With Angular framework is more easier to bind event
&amp;lt;input type=&amp;#34;text&amp;#34; (keyup.enter)=&amp;#34;onEnter()&amp;#34;&amp;gt; onEnter(): void { console.log(&amp;#34;submit&amp;#34;); } SourceCode
you can change another key like shift or anthoer you want</description></item><item><title>KeyValuePipe使用細節</title><link>https://tonny0531.github.io/post/angular/keyvaluepipe/</link><pubDate>Mon, 15 Aug 2022 09:23:48 +0800</pubDate><guid>https://tonny0531.github.io/post/angular/keyvaluepipe/</guid><description>前言 Angular 提供了相當於 Object.keys 的 Pipe 給大家使用，但有個細節卻常常被忽略
就是排序的行為，在官方預設會進行排序
舉例 預期的資料如下
創建中 取消或未過審 募資中 募資成功 募資失敗 在開發的過程中想像應該也會是一樣的顯示才對
但實質上會變成
創建中 募資失敗 募資中 募資成功 取消或未過審 可以看到其中兩筆順序已被對調
回頭去看官方的 Pipe 的用法說明
{{ input_expression | keyvalue [ : compareFn ] }} 後方會有 compareFn 可以注入 而固定回傳 0 就會變成原始資料了
SampleCode
參考資料 angular keyvalue pipe sort properties / iterate in order KevValuePipe</description></item></channel></rss>