I'm new to AngularJS - trying to build a pretty vanilla todo-list app. I can't figure out how to push the text value from the input box into the 'todos' array.
Here's my code.
HTML:
<body ng-controller="MainCtrl">
<div class="container">
<div class="main">
<p>Todo App</p>
<input ng-model="todoList" type="text" name="input" placeholder="Enter tasks here">
<button ng-click="addTodo()">Add</button>
<ul>
<li ng-repeat="todo in todos">
{{todo}
</li>
</ul>
</div>
</div>
</body>
JS:
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.todos = []
$scope.todoList = "";
$scope.addTodo = function(){
$scope.todos.push($scope.todoList)
}
$scope.clearAll = function(){
$scope.todos = []
}
});
Thanks in advance!
}
is missing in{{ todo }
– valverde93 Jun 2 '15 at 14:00