1
這是我main.js文件: 我有我的模型tasksList數據和右眼下方那是我的控制器如何綁定我的模型數據以查看?
var tasksList = [{description: 'Pick up mail at Post office today at noon'},
{description:'Pay the electric bills'}];
todoApp.controller('TasksCtrl',['$scope', function($scope){
$scope.ngRepeat = function(){
var i = 0
alert('hi');
$scope.tasksList.push(tasksList[i++]);
};
}]);
我的看法是這樣的:
<div ng-init ng-controller ='TasksCtrl' class='task-column'>
<div ng-repeat='(key,task) in tasksList' class='task-list'>
<div class='easy'>
<div class='div-list-style'></div>
<div id='task-{{key}}' style='cursor:pointer;z-index:5' ng-click='toggleHide(key)' class='options pull-right glyphicon glyphicon-pencil'></div>
<div class='task-desc' ng-bind='task.description'></div>
<div ng-show='taskEdit[key]'>
<form class='edit-form'>
<textarea ng-model='task.description' class='tasks-textarea'></textarea>
<div md-content class='date'>
<div md-datepicker ng-model='dueDate' md-placeholder='due date'></div>
</div>
</form>
</div>
</div>
</div>
</div>
有什麼問題? –
我在tasksList中的數據沒有顯示。我試圖用ng-repeat來遍歷它 – joejoeso