開始學習AngularJS的一個好方法是創建經典應用程序“Hello World!”:
使用您喜愛的文本編輯器,創建一個HTML文件,例如:helloworld.html。
將下面的源代碼複製到您的HTML文件。
在web瀏覽器中打開這個HTML文件。
HTML 源代碼
<!doctype html> <html ng-app> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"> </script> </head> <body> Hello {{'World'}}! </body> </html>
請在您的瀏覽器中運行以上代碼查看效果。
由於偉大的牆的存在, js 文件可能獲取不到, 提供一個備用地址: http://cdn.bootcss.com/angular.js/1.2.3/angular.min.js