Simple AngularJS questions that I can't get my head around.
Plunkr: http://plnkr.co/edit/OjaooVOQBEETkhaZFbWG?p=preview
HTML;
<div ng-repeat="label in likedLabels">
<input ng-model="likedLabels[$index]">
</div>
{{likedLabels}}
<button ng-click="addInput()">+add more inputs</button>
JS:
$scope.likedLabels = ['']
$scope.addInput = function(){
$scope.likedLabels.push('');
}
I'm basically trying to create a user-operated way of adding input boxes and having the content inside linked to a model. What am I doing wrong here?