我試圖讓一個例子類似的例子在https://angularjs.org/角JS - NG-重複工作不正常
這裏是JS撥弄我創建。
有人可以幫忙。這有什麼問題?
HTML是..
<h2>
To Do
</h2>
<div ng-controller="ToDoListController as todoList">
<ul>
<li ng-repeat="todo in todoList.todos">
{{todo.text}}
</li>
</ul>
</div>
和JS部分是
angular.module('todoApp',[]).controller('ToDoListController',
function(){
var todoList = this;
todoList.todos = [
{text:'learn angular', done:true},
{text:'build an angular app', done:false}];
});
Link了JS提琴。
所以你的意思是我需要添加
作爲body標籤? – Ketan@ketan是的,否則它會顯示'body ng-app =「todoApp」'作爲文本 – Amit
謝謝你。但是我將Angular JS作爲外部js加入了小提琴。有沒有其他的方式來添加這個? – Ketan