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官方教學視訊。
It Is Also A Guide To Hyundai Key Replacement In 2023
Hyundai I30 Replacement key uk
The 10 Scariest Things About Therun Under Desk
Treadmill folding treadmill desk
Way cool! Some extremely valid points! I appreciate you writing this article plus the rest of the website is really good.
5 Killer Quora Answers To Private Psychiatrist London Private Psychiatrist London
14 Businesses Doing An Amazing Job At Mesothelioma Lawsuit
Attorneys mesothelioma Attorneys power plant worker
10 Websites To Help You To Become A Proficient In 3 Seater Chaise chaise sectional (http://Gwwa.Yodev.net/)
Guide To Self Emptying Robot Vacuum For Pets: The Intermediate Guide To Self Emptying Robot Vacuum For Pets self Emptying robot vacuum for Pets
Five Killer Quora Answers On Bi Folding Door Repair Bi Folding Door Repair
Bifold Door Seal Replacement Tools To Ease Your Daily Lifethe
One Bifold Door Seal Replacement Trick Every Person Should Be Able To Bifold door seal replacement
What Is The Reason ADHD Tests Is The Right Choice For You?
Adhd Symptoms Test
4 Dirty Little Tips About The Mesothelioma Law Industry mesothelioma attorneys
Learn More About Childrens Bunk Beds While Working From At Home Bunk Beds usa
Link Togel Tools To Ease Your Daily Life Link Togel Technique Every Person Needs To Know link togel
You’re About To Expand Your Jaguar Xe Key Fob Options jaguar x type key fob reprogramming; http://namhaehappy.com/bbs/Board.php?bo_table=free&wr_id=530982,
Five Killer Quora Answers To Mesothelioma Attorneys mesothelioma (Stormy)
I have taken notice that in digital cameras, extraordinary receptors help to {focus|concentrate|maintain focus|target|a**** automatically. The particular sensors involving some camcorders change in contrast, while others make use of a beam with infra-red (IR) light, specially in low light. Higher specs cameras at times use a mix of both techniques and will often have Face Priority AF where the digicam can ‘See’ your face and focus only in that. Thank you for sharing your notions on this blog site.
Thank you for the good writeup. It in fact was a enjoyment account it. Look complex to more brought agreeable from you! By the way, how can we keep in touch?
See What Treadmills For Home UK Tricks The Celebs Are Utilizing treadmills for home uk; Tony-sheryl.Com,
In this awesome scheme of things you’ll receive a B+ with regard to hard work. Where you actually lost everybody was on the facts. You know, it is said, the devil is in the details… And it could not be more accurate at this point. Having said that, permit me say to you exactly what did do the job. Your authoring can be quite powerful and this is possibly the reason why I am taking an effort to comment. I do not really make it a regular habit of doing that. Next, although I can easily notice a leaps in logic you make, I am not really confident of exactly how you appear to connect your points that produce the conclusion. For now I will, no doubt subscribe to your position but wish in the future you actually connect the facts much better.
Golf Clubs – Having The Right Club For Your Game 중구오피
So, wearing sunglasses may also help to prevent recurrences.
Spectacular products about ED at cephalexin 500mg can be a sexual stimulant for women?
If you have these symptoms, see a doctor as soon as possible.
The People Nearest To Best Male Adult Toys Tell You Some Big Secrets Best Sex Toys for him and her
Hi there this is kinda of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding skills so I wanted to get guidance from someone with experience. Any help would be greatly appreciated!
That is the proper blog for anyone who wants to search out out about this topic. You realize a lot its virtually onerous to argue with you (not that I actually would want?HaHa). You undoubtedly put a brand new spin on a topic thats been written about for years. Great stuff, simply great!
I enjoy reading through an article that can make men and women think. Also, thank you for allowing for me to comment.
20 Reasons Why Car Locksmith Will Not Be Forgotten cost
Why Glass Window Replacement Near Me Is More Difficult Than You Imagine replacement of window glass
Through a series of biochemical steps too boring to go into even here, the heme is changed into bilirubin.
to get what you needOnline comparison shopping allows you to oxycodone and neurontin do not require a prescription.
Benzodiazepines can have many side effects, which are generally associated with chronic use.
We all laughed a lot, took turns rubbing the bald sides of my head and fluffing through the tufts of hair remaining on the top.
When you buy a drug online at low price of can keflex be crushed at any time.
Therefore it is anticipated that the novel H1N1 vaccine will have the same excellent safety profile as the seasonal flu vaccine.
15 Gifts For The Built In Fridge Freezer Lover In Your Life Integrated fridge and freezer