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官方教學視訊。
Great site! I recommend to everyone!web design in fort smith
Kazanmak icin harika bir kumarhane Sweet bonanza
A Glimpse Inside The Secrets Of Double Glazing Repair Leeds Double glazed Window repairs
I’m extremely pleased to discover this page. I need to to thank you for ones time for this particularly wonderful read!! I definitely savored every bit of it and i also have you book-marked to see new things in your blog.
Texas Hold’em Tip – Pay Attention 에볼루션 코리아바카라
purchase atorvastatin sale – buy bystolic 20mg generic brand nebivolol 20mg
Refinancing Home? Don’t Let These Common Problems Derail Your Loan 국민은행 대출
How In Order To Credit Card Debt – Most Effective Suggestions And Advice 버팀목 대출
Used Car Loan: Tips Before You Get A Car 다바오 관광
Credit Card Printers To Print Plastic Cards – Loyalty,
Gift And Membership Cards 다바오 포커 머니
En iyi kumarhaneyi tavsiye ederim Sweet bonanza
Guvenilir bir kumarhanede sans?n?z Sweet bonanza
Can I simply just say what a relief to uncover someone who really understands what they’re talking about online. You actually understand how to bring an issue to light and make it important. More and more people should look at this and understand this side of your story. I was surprised that you are not more popular since you most certainly have the gift.
Love Bank Deposits Get Your Ex Back 다바오 회원가입
That is a great tip particularly to those new to the blogosphere. Brief but very accurate info… Appreciate your sharing this one. A must read post.
No Deposit Casinos Are Fantastic To Use 에볼루션 카지노 라이브
Seo Tips – Exactly What Is Another Backlink? SEO (http://fiaipmanager.fiaip.it)
How Window Repair Near Has Become The Most Sought-After Trend Of 2023 Upvc Window Repair Near Me
Adwords Marketing Tips – Checklist For Prime Quality
Score 검색엔진최적화 메타태그
Bu kumarhanedeki en iyi oyunlar Sweet bonanza
How To Get Quality Backlinks For Your 백링크 프로그램
Guvenilir bir kumarhanede oynay?n Sweet bonanza
I’m amazed, I must say. Rarely do I come across a blog that’s equally educative and engaging, and let me tell you, you have hit the nail on the head. The problem is something that too few folks are speaking intelligently about. Now i’m very happy that I stumbled across this during my hunt for something regarding this.
Should I Prefer Meta Tags For Search Engines Like Google
Optimization? 구글상위노출 대행사
Pay Attention: Watch Out For How Upvc Doors Crawley Is Taking Over And What
Can We Do About It timber Doors crawley
How To Check On Keyword Competition – And Dominate Figure Out!
백링크 사이트
En guvenilir kumarhanede kazan?n Sweet bonanza
You have made some good points there. I looked on the internet for more information about the issue and found most individuals will go along with your views on this web site.
Seveceginiz bir kumarhane Sweet bonanza
You’re so awesome! I do not think I have read a single thing like this before. So good to discover another person with a few unique thoughts on this subject. Seriously.. thank you for starting this up. This site is something that is needed on the internet, someone with a little originality.