AngularJS – Directive & Filter 介紹篇
為了方便文章閱讀,本篇將filter翻譯成過濾器、directive翻譯成指示指令
在看過前幾篇的AngularJS的教學後,我們對AngularJS的開發應該有了基本的認識,針對HTML文件中我們的操作有:
針對頁面引入應用程式模組
<html ng-app="store">
針對頁面引入控制器
<body ng-controller="StoreController as store">
針對頁面去顯示或隱藏元素
<h1 ng-show="name">Hello, {{ name }} !</h1>
針對大量的資料設定重複的區域
<li ng-repeat="product in store.products">{{ product.name }}</li>
接下來針對過濾器來介紹,依下圖所示產品價格的部分,有的是有小數點有的沒有,會造成頁面在資料呈現上的參差不齊。
若我們在該表達式(expression)加上一條直線(pipe),在直線後面可以加入一些過濾器,本範例加入的是貨幣格式的過濾器,當加入後價格在頁面上顯示的格式,就會自動加上了$符號和兩位數的小數點。
我們也可以在過濾器後面利用冒號再加上一些選項,讓呈現的資料更不同,例如下圖中date格式中是以「月/日/年 @ 時:分AM」這樣的方式顯示,而除了貨幣currency、日期date的過濾器之外,還包含有大小寫轉換的uppercase、lowercase、字數也可以當成資料呈現筆數的limitTo、另外還有可以針對重複性的資料進行排序的orderBy,大概的使用方式可以參考下圖,或是在JS Bin看看馬老師製作的案例。
另外關於指示指令部分,在這次的案例上我們加上產品的圖片,圖片的部分有兩種,一個是大圖;另一個是產品的縮圖,也因為有兩種不同的資料,要注意他被加在數列裡面的方式。
在頁面上顯示圖片的方式要注意不是用src的屬性去呈現,而是需要用ng-src這個屬性,加上圖片欄位的表達式即可,在JS Bin上面觀賞本案例程式碼。
※以上截圖部分為AngularJS官方教學視訊,另有filter指令介紹的專頁和所有filter清單。
Привет, друзья!
Мы изготавливаем дипломы любой профессии по приятным тарифам.
conectta2.com/read-blog/814_ishem-proverennyj-magazin-s-diplomami-i-attestatami
Hmm it appears like your website ate my first comment (it was super long) so I guess I’ll just sum it up what I submitted and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to the whole thing. Do you have any points for beginner blog writers? I’d certainly appreciate it.
Привет, друзья!
Мы изготавливаем дипломы любой профессии по невысоким ценам.
andersonobserver.squarespace.com/news/2017/4/12/library-sponsors-april-poetry-contest
https://cytotecbestprice.pro/# buy cytotec over the counter
https://cytotecbestprice.pro/# Abortion pills online
https://nolvadexbestprice.pro/# where can i buy nolvadex
tamoxifen 20 mg: does tamoxifen cause menopause – tamoxifen bone density
Привет!
Удивительно, но купить диплом кандидата наук оказалось не так сложно
matthiasjakobbecker.com/купить-диплом-проверенные-способы
Поможем вам всегда!.
You can play memory games together with your kids by using memory games for kids online. They are both more efficient and appropriate for children because these games are more colorful and entertaining. Sodium is a free and open-source optimization mod for the popular sandbox game, Minecraft. This game utility improves the frame rates of your vanilla game by… RELATED: 12 Verbal Literacy Games for Speaking, Listening & Thinking Assassin’s Creed is an action-adventure game developed by Gameloft, which features a simple yet exciting gameplay. It lets you explore the Middle Ages as you… Simple memory games for kids are also a useful screen-free tool for parents. Not only are they brain-stretchers, but they are great boredom busters. Many of these memory games for kids can be added to your repertoire of waiting games. In case you missed it… my 20 waiting games for kids that can be played anywhere was an overnight sensation! (Okay, perhaps I exaggerate a wee bit. But it did strike a chord with a lot of parents!)
https://www.anobii.com/en/012a4e365012b5801a/profile/activity
map tile fantasy mansion house haunted halloween See why this is considered one of the most terrifying horror games of all time! Nobody is willing to enter an abandoned house where the entire family committed suicide, but you’re looking for the truth… unfortunately, somewhere in the dark, something is looking for you too… The House is a very scary point and click game. Be warned. Enter the house a deserted house that was build in the 1970. It was knew that the previous family that resided in this house all committed suicide. After that accident no one have ever enter this house again. As we said, you have the option to play with a group of people, or you can decide to split up (for example, if you are in a dark forest and your task is to find notes). You can also join your team to fight a terrible monster controlled by someone other than users. Both of these modes fit perfectly not only in the genre of shooters, but also in scary games.
tamoxifen warning: alternatives to tamoxifen – does tamoxifen cause weight loss
Здравствуйте!
Легальная покупка диплома о среднем образовании в Москве и регионах
gaiassulin.com/диплом-о-среднем-образовании-как-и-где
Всегда вам поможем!.
Здравствуйте!
Приобрести документ ВУЗа вы можете у нас в столице.
ast-diplom.com/kupit-diplom-s-registraciej
http://propeciabestprice.pro/# order cheap propecia without a prescription
prednisone buy: 25 mg prednisone – prednisone daily
http://prednisonebestprice.pro/# prednisone daily
https://propeciabestprice.pro/# cost of cheap propecia pill
buy generic zithromax online: cheap zithromax pills – zithromax without prescription
buy prednisone no prescription how to get prednisone without a prescription prednisone uk over the counter
zithromax buy: where to get zithromax – how to get zithromax over the counter
order cheap propecia price get cheap propecia without dr prescription cost of propecia without insurance
zithromax 600 mg tablets [url=https://zithromaxbestprice.pro/#]generic zithromax 500mg india[/url] buy zithromax online
[u][b] Привет, друзья![/b][/u]
Мы можем предложить документы ВУЗов
[url=http://restoranica.ru/forum/user/4868/]restoranica.ru/forum/user/4868[/url]
[url=http://wegug.in/blogs/1251/Быстрое-получение-диплома-онлайн/]wegug.in/blogs/1251/Быстрое-получение-диплома-онлайн[/url]
[url=http://baxoday.maxbb.ru/viewtopic.php?f=25&t=526/]baxoday.maxbb.ru/viewtopic.php?f=25&t=526[/url]
[url=http://asepbook.com/read-blog/4798/]asepbook.com/read-blog/4798[/url]
[url=http://pesnibardov.ru/f/viewtopic.php?f=2&t=227685/]pesnibardov.ru/f/viewtopic.php?f=2&t=227685[/url]
Привет!
Купить диплом о высшем образовании.
funnywipes.maxbb.ru/viewtopic.php?f=3&t=650&sid=df92afa0c7d75ba2628d12455dec1d73
Здравствуйте!
Мы можем предложить дипломы любых профессий по выгодным тарифам.
br-totalbyg.dk/2024/07/13/купить-диплом-безопасно
You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page. The most important step for a newcomer to online poker is to cross check the reliability of the poker site he is accessing and planning to play on. Make sure that the online poker room you’re playing on conforms to the laws of the land and is legally safe to register in. Low-stakes cash games of up to NL25$ inclusive are the most popular here. You can find 20-50 active tables on average in the evening. Also, there’s some action in 9-max Zoom Poker at NL2$ stake. The higher-stakes cash games can be usually played at up to NL200$, with 5-10 active tables at each stake. BetOnline is one of the newest poker sites to hit the market. The poker room launched in 2011 and is backed by the largest US sportsbook. BetOnline is powered by the Hero Poker Network which is compatible with both Mac and Windows OS. The poker room attracts loads of fish from both the casino and sportsbook making most Hold’em games in the low to micro limits easy to beat. Join BetOnline through us and receive an exclusive 25% instant cash poker bonus on all deposits!
http://www.fshrental.com/yc5/bbs/board.php?bo_table=free&wr_id=48744
You wont find the PokerStars real money app download in the Google Play Store, only the PokerStars Lite app. To download the real money version of the PokerStars Android app, you need to get it directly from their website (pokerstars not pokerstars.eu or pokerstars.es). The reason that is not listed at the Play Store is that Google does not allow foreign gambling apps in another country. PokerStars is a licensed safe online poker site based in the UK. Video Poker Classic greets you with bustling slot machine that sounds like you’re in the middle of a casino. Claiming to be the No1 video poker game app on mobile, it offers a sizable roster of 39 games. This includes but is not limited to Ultra Bonus Poker, All American, Joker Poker and many more. Each game has a single-hand and multi-hand version.
ВНЖ Испании ВНЖ Испании .
Здравствуйте!
Как получить диплом техникума с упрощенным обучением в Москве официально
vibesvietnam.com/диплом-о-высшем-купить-в-москве
Всегда вам поможем!.
Привет, друзья!
Диплом по специальности на выбор
diigo.com/item/note/8p2f0/1qd2?k=e4006d0f698cee3ec1a2fbdd7d2783d9
http://zithromaxbestprice.pro/# where can i buy zithromax in canada
Привет, друзья!
Мы изготавливаем дипломы любых профессий по разумным тарифам.
2dommedical.com/2024/07/14/купить-заочный-диплом