AngularJS – 基本介紹篇
看完上一篇有關AngularJS的文章之後,如果你已經產生對他的興趣,接下來我們就跟著Google規劃的課程來學習,其實在AngularJS的官方網頁上,本來就有這方面的視訊教學(當然是英文的囉!),馬老師這邊只是做到整理、翻譯和提出我的一些想法,讓想要學習他的人可以更方便,官方視訊總共分成五個等級,每個等級又分成不同章節,章節結束後還都會有模擬測驗,真的推薦大家可以去看看喔!
首先檢視一下要學習AngularJS的一些背景條件:
必須了解的部分指的是技術領域,最好能懂的部分是指開發時的觀念
![AngularJS Part1 Slide1](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide1.png)
至於選擇AngularJS的理由有以下幾點:
- 幫助你組織Javascript
- 快速幫你建構動態網站
- 可以跟jQuery合作愉快
- 便於測試
![AngularJS Part1 Slide2](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide2.png)
接下來官方教學以ng-controller為案例,教導AngularJS是如何去呼叫函數的,不過這部分在1.3以上的版本已經不是這樣使用了要特別注意!
![AngularJS Part1 Slide3](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide3.png)
以下就針對這個案例進行程式的示範,在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)。
![AngularJS Part1 Slide4](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide4.fw_.png)
上述的程式可以撰寫在一個JS檔案中,讓網頁將該檔案引用。
![AngularJS Part1 Slide5](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide5.fw_.png)
接下來在HTML標籤中加入ng-app=”Application Name”後,讓網頁在載入的時候就會自動運行該模組(Module)。
![AngularJS Part1 Slide6](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide6.fw_.png)
接下來開始介紹表達式,不過這個在上一篇案例當中我們已經有使用過了,相信大家也很容易能夠了解,也建議大家去參考視訊中提到的網頁,裡面有更多有關於表達式的說明。
![AngularJS Part1 Slide7](http://cloudlab.tw/wp/wp-content/uploads/2015/02/AngularJS-Slide7.fw_.png)
※以上截圖部分為AngularJS官方教學視訊。
The Complete Guide To Buy Mobility Scooters Near Me 6699101
Why No One Cares About Collapsible Scooter
arlennizo
‘How Come I Always Lose Poker Online – Are They Cheating?’ Says Newbie 다바오 지진
The Two Most Popular Types Of Slots Exactly Why People Play Them 에볼루션 알가격
This is a topic that is near to my heart… Take care! Exactly where are your contact details though?
Отличный сайт! Всем рекомендую!бумажные пакеты
Top 10 Seo Methods That Can Improve The Ranking Of
One’s Website 구글상위노출 트래픽 (e-austinlaw.com)
Roulette Assault Review – Read My Story! 에볼루션 파워볼 (cornerstoneagencyinc.com)
I’d personally also like to state that most people who find themselves without the need of health insurance usually are students, self-employed and those that are jobless. More than half with the uninsured are under the age of Thirty-five. They do not sense they are looking for health insurance simply because they’re young and also healthy. Its income is frequently spent on houses, food, and entertainment. Many individuals that do go to work either entire or part time are not offered insurance by way of their jobs so they get along without because of the rising expense of health insurance in the states. Thanks for the concepts you share through this website.
Dealing With Personal Loans 다바오 포커 (http://www.aha.ru)
What Online Gifts Came To Mean To The Shopper 에볼루션 마틴
Найдите рабочее зеркало 1вин для беспрепятственного доступа.
1вин зеркало рабочее всегда доступно для вас.
Website Marketing For New Webmasters 구글상위노출 업체
5 Points We May Overlook When Getting A Car Loan 저신용자 대출
1вин зеркало обеспечивает стабильный доступ к любимым играм.
Зеркало 1win поможет вам продолжить игру без перебоев.
Are You Ready Spend Money On Bank Foreclosure Homes?
대학생 생활비 대출
Mobile Casinos – Microgaming-Spin3 Software 에볼루션 바카라 사이트
Small Personal Loans, Bad Credit – Sufficient Funds With Bad Credit 다바오 모바일 설치
Используйте 1win зеркало для доступа к сайту даже при блокировке.
Ищете надёжный ресурс? 1вин сайт предоставляет всё необходимое для азартных игр.
Great site you’ve got here.. It’s difficult to find good quality writing like yours these days. I truly appreciate individuals like you! Take care!!
1вин казино предлагает уникальные бонусы и высокие шансы на выигрыш.
1win официальный сайт гарантирует честные игры и надежные выплаты.
Попробуйте свою удачу в 1win casino и выиграйте крупные призы.
Играть в 1win казино можно с любым устройством, получая удовольствие от высокого качества игр.
I was very happy to uncover this page. I want to to thank you for ones time for this wonderful read!! I definitely really liked every little bit of it and i also have you saved as a favorite to see new things in your blog.
На 1вин сайт вы найдете последние новости и лучшие предложения для игроков.
Официальный 1win сайт предлагает разнообразные азартные игры и выгодные ставки.