2013年7月1日 星期一

Angular js 練習 say hi

1.
首先開啟
http://jsbin.com

2.
在做上方的 add library

3.
加入 angular js 的 js檔
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js"></script>

4.

在 <html> 標籤上,加上一個 ng-app 屬性
這就是所謂的 宣告式語法 (Directives),以 ng-app  來說,這是用來宣告整份 html 都屬於 AngularJS 的管轄!

5.
在<body>標籤中加入以下的code

<label>Name:</label>
 <input type="text" ng-model="yourName" placeholder="Enter a name here">
 <hr>
 <h1>Hello {{yourName}}!</h1>


接下來您可以在output中看到結果 ~!!


0 意見:

張貼留言