AngularJS – 基本介紹篇
看完上一篇有關AngularJS的文章之後,如果你已經產生對他的興趣,接下來我們就跟著Google規劃的課程來學習,其實在AngularJS的官方網頁上,本來就有這方面的視訊教學(當然是英文的囉!),馬老師這邊只是做到整理、翻譯和提出我的一些想法,讓想要學習他的人可以更方便,官方視訊總共分成五個等級,每個等級又分成不同章節,章節結束後還都會有模擬測驗,真的推薦大家可以去看看喔!
首先檢視一下要學習AngularJS的一些背景條件:
必須了解的部分指的是技術領域,最好能懂的部分是指開發時的觀念
至於選擇AngularJS的理由有以下幾點:
- 幫助你組織Javascript
- 快速幫你建構動態網站
- 可以跟jQuery合作愉快
- 便於測試
接下來官方教學以ng-controller為案例,教導AngularJS是如何去呼叫函數的,不過這部分在1.3以上的版本已經不是這樣使用了要特別注意!
以下就針對這個案例進行程式的示範,在1.2(含)以前的AngularJS可以這樣來操作ng-controller:(在JS Bin上測試)
<!doctype html> <html ng-app> <head> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <meta charset="UTF-8"> <title>controllerExample</title> <script> function myFn() { alert("歡迎光臨馬老師雲端研究室"); } </script> </head> <body ng-controller="myFn"> </body> </html> 但在1.3(含)之後的AngularJS需要這樣來操作ng-controller:(在JS Bin上測試) <!doctype html> <html ng-app="controllerExample"> <head> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <meta charset="UTF-8"> <title>controllerExample AngularJS 1.3.2</title> <script> angular.module('controllerExample', []) .controller('myFn', function (){ alert("歡迎光臨馬老師雲端研究室"); }); </script> </head> <body ng-controller="myFn"> </body> </html>
根據上面的案例,來介紹利用AngularJS開發網頁時的流程和方式:
首先我們可以先建立一個模組(Module),在模組內會包含AngularJS的函式名稱、應用程式名稱(Application Name)和相關函式庫(Dependencies)。
上述的程式可以撰寫在一個JS檔案中,讓網頁將該檔案引用。
接下來在HTML標籤中加入ng-app=”Application Name”後,讓網頁在載入的時候就會自動運行該模組(Module)。
接下來開始介紹表達式,不過這個在上一篇案例當中我們已經有使用過了,相信大家也很容易能夠了解,也建議大家去參考視訊中提到的網頁,裡面有更多有關於表達式的說明。
※以上截圖部分為AngularJS官方教學視訊。
15 Presents For Your Mesothelioma Law Firm Lover In Your Life Mesothelioma litigation Lawyer
9 Lessons Your Parents Taught You About Mesothelioma Lawyers Mesothelioma Lawyers
10 Things That Your Competitors Learn About Mesothelioma
Lawsuit mesothelioma case (https://rjrl69.com/bbs/board.php?bo_table=free&wr_id=74686)
Incontestable Evidence That You Need Mesothelioma Legal mesothelioma legal specialist
Профессиональный сервисный центр по ремонту ноутбуков и компьютеров.дронов.
Мы предлагаем:ремонт ноутбуков москва
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:сервисные центры по ремонту техники в спб
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Профессиональный сервисный центр по ремонту холодильников и морозильных камер.
Мы предлагаем: ремонт холодильников
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Why Everyone Is Talking About Kia Key Fob Replacement Right Now kia Rio Replacement key
ремонт apple watch
You’ll Never Guess This Ford Key Cutting’s Secrets replacement ford focus key fob (dac21.com)
Guide To Mesothelioma Legal: The Intermediate Guide On Mesothelioma
Legal mesothelioma
7 Things About Mesothelioma Attorneys You’ll Kick Yourself For Not Knowing mesothelioma law Firms
10 Misleading Answers To Common Subaru Forester Replacement Key Questions Do You Know Which Answers?
subaru key Fob
This Is The Intermediate Guide For Upvc Repairs Near Me upvc windows
repairs near me (Robby)
15 Things You Don’t Know About Double Glazing
Windows Cambridgeshire window Repairs Near Me
20 Things You Must Be Educated About Mesothelioma Case mesothelioma settlement (http://pathwel.co.kr/bbs/board.php?bo_table=free&wr_id=141261)
14 Questions You’re Afraid To Ask About Mesothelioma Lawsuit Mesothelioma case
Your blog post made me see [topic] in a whole new light. Thank you for broadening my perspective.
What Makes The Citroen Dispatch Remote Key Replacement So Effective?
In COVID-19 citroen Key case Replacement
Getting Tired Of Mesothelioma Lawyer? 10 Inspirational Resources To Invigorate Your Love mesothelioma law firm (http://aisoft.co.kr/bbs/board.php?bo_table=free&Wr_id=208678)
What Is Fiat Key Cover? History Of Fiat Key Cover In 10 Milestones Fiat 500 Key Button Replacement
10 Of The Top Mobile Apps To Use For Post Depression Symptoms Depression Symptoms In Children [https://Www.Medivia.Co.Kr]
Five Reasons To Join An Online ADHD Private Diagnosis Shop And 5
Reasons Not To private adhd assessment adult cost
20 Fun Infographics About Double Glazing Repairs
Bristol upvc Door repairs Bristol
How Mesothelioma Settlement Impacted My Life The Better Mesothelioma Claims
How To Make A Profitable Replacing Lost Car Keys Ford When You’re Not Business-Savvy
ford key Fob replacement (hk3Bn1fqjo83e.kr)
How Double Glazing Repair Maidstone Became The Hottest Trend In 2023 maidstone Window companies
A Proactive Rant About Adult ADHD Diagnosis how to
get adhd diagnosis uk adults [Melaine]
Mental Health Assessments: 11 Things That You’re Failing To
Do best practice mental health Assessment
Once I initially commented I clicked the -Notify me when new feedback are added- checkbox and now every time a comment is added I get four emails with the same comment. Is there any means you may remove me from that service? Thanks!