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官方教學視訊。
can i take spironolactone at night
what is robaxin prescribed for
Everything You Need To Be Aware Of CS GO Case Battle
Gloves Cases
Отличный сайт! Всем рекомендую! выезд нотариуса на дом
order ventolin 4mg pills – purchase ventolin inhalator buy theophylline no prescription
ivermectin pills – doryx buy online cefaclor uk
The No. Question That Everyone In Lovense Sexmachine Should Be Able
To Answer fuck machine to buy (https://www.koreafurniture.com/bbs/board.php?bo_table=free&wr_id=3740414)
Learn More About How To Get Diagnosed With ADHD
In Adults While Working From Home how to get diagnosed with adhd (Kristofer)
Отличный сайт! Всем рекомендую, качественный и быстрый ремонт техники! ремонт айфонов
The Reasons Audi Key Fobs Is More Tougher Than You Imagine audi replacement key cost
Where Can You Find The Most Effective Car Diagnostic Garage Near Me Information? Bmw diagnostics
10 Double Glazing Deals Near Me Meetups You Should Attend Local Double Glazing Repairs
A How-To Guide For Renault Megane Key Card Replacement From Start To Finish renault megane key card replacement
Отличный сайт! Всем рекомендую, качественный и быстрый ремонт техники! ремонт iphone спб
11 Methods To Redesign Completely Your American Style Fridge Freezers uk fridge freezer
10 Facts About Headphones Noise Cancelling That Will Instantly
Put You In Good Mood wireless headphones shopping
The Ultimate Glossary Of Terms For Ghost 2 Immobiliser Fitting
Near Me Autowatch Ghost Immobiliser Fitting
order generic azithromycin 250mg – ofloxacin order online cost ciprofloxacin 500 mg
Unexpected Business Strategies Helped Replacing Volkswagen Key Achieve Success How To Fix Volkswagen Key Fob
remeron for appetite stimulation
15 Pinterest Boards That Are The Best Of All Time About Auto Locksmiths Near Me locksmiths near me Auto
repaglinide fk
10 Facts About Upvc Window Repairs That Can Instantly
Put You In An Upbeat Mood Upvc Window Repairs Near Me
10 Things You Learned In Kindergarden That Will Help You With Ghost Installations Autowatch
14 Smart Strategies To Spend Leftover Adult Toy Store Near Me Budget adult store for men
The Reasons Erb’s Palsy Lawsuit Is The Most Sought-After Topic In 2023 erb’s palsy
lawsuit (https://forum.med-click.ru/index.Php?action=profile;u=907383)
A Provocative Rant About Washer Dryer With Heat Pump washer dryer
with heat pump (https://notabug.org/)
20 Reasons To Believe Washing Dryer Combo Will
Never Be Forgotten integral Washing machine
15 Best Pinterest Boards Of All Time About Nissan Juke Key Fob nissan qashqai replacement key
buy cleocin tablets – vantin sale cheap chloromycetin sale