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清單。
Добрый день!
Удивительно, но купить диплом кандидата наук оказалось не так сложно
wk82.xyz/home.php?mod=space&uid=63030
Окажем помощь!.
Link pyramid, tier 1, tier 2, tier 3
Level 1 – 500 links with inclusion embedded in pieces on article portals
Tier 2 – 3000 web address +Redirect links
Tier 3 – 20000 connections assortment, feedback, writings
Utilizing a link hierarchy is useful for search engines.
Necessitate:
One connection to the platform.
Key Phrases.
Accurate when 1 query term from the content subject.
Remark the supplementary feature!
Vital! Tier 1 links do not overlap with Secondary and Tertiary-tier links
A link structure is a device for boosting the circulation and backlink portfolio of a website or online community
Привет, друзья!
Купить документ института вы можете у нас в столице.
ast-diplom.com/kupit-diplom-kazan
заказать шлюху проститутки щелково
buying prescription drugs in mexico best online pharmacies in mexico mexican online pharmacies prescription drugs
проститутки селигерская проститутки индивидуалки москвы
проститутки котельники https://samara.prostitutki.sex
Привет, друзья!
Заказать документ о получении высшего образования можно у нас в Москве.
ast-diplom.com/kupit-diplom-perm
mexico drug stores pharmacies: mexico pharmacies prescription drugs – buying prescription drugs in mexico online
проститутки новокосино заказать проститутку
mexican drugstore online: reputable mexican pharmacies online – mexican pharmaceuticals online
You really make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!
medicine in mexico pharmacies: mexican rx online – buying from online mexican pharmacy
mexican pharmaceuticals online: reputable mexican pharmacies online – mexican border pharmacies shipping to usa
pharmacies in mexico that ship to usa: mexico drug stores pharmacies – mexican drugstore online
проститутки в одинцово проститутки метро домодедовская
проститутки коломна https://samara.prostitutki.sex
Здравствуйте!
Купить документ института
landik-diploms-srednee.ru/kupit-diplom-v-kazani
проститутки зрелые проститутки
buying prescription drugs in mexico: mexican mail order pharmacies – mexican drugstore online
проститутки люберцы индивидуалки балашиха
mexican rx online: mexico drug stores pharmacies – mexico drug stores pharmacies
Привет!
Диплом о высшем образовании
seaman.com.ua/forum/index.php?threads/diplomy-dlja-professionalnogo-rosta.37899
Добрый день!
Приобретение диплома ПТУ с сокращенной программой обучения в Москве
diplommann.ru
medicine in mexico pharmacies medication from mexico pharmacy mexican rx online
Здравствуйте!
Приобрести документ ВУЗа можно в нашей компании.
ast-diplom.com/kupit-diplom-novosibirsk
Привет, друзья!
Купить документ о получении высшего образования
landik-diploms-srednee.ru/attestat-shkoly
Здравствуйте!
Диплом бакалавра
souzzverg.forumbb.ru/login.php
Привет!
Полезные советы по безопасной покупке диплома о высшем образовании
nichtsdestotrotz.com/category/fitness/page/6
Рады оказать помощь!.
mexican border pharmacies shipping to usa mexican mail order pharmacies reputable mexican pharmacies online