I'm having trouble inserting my data into the list
array
angular.module('myApp', [])
.controller("myCtrl", function($scope) {
$scope.list = ["call naina", "eat food", "do less work", "take meds"];
$scope.a = false;
$scope.d = false;
$scope.k = false;
$scope.text = '';
$scope.change = function() {
$scope.a = !$scope.a;
};
$scope.changd = function() {
$scope.d = !$scope.d;
};
$scope.remove = function(x) {
$scope.list[x] = "";
};
$scope.add = function() {
$scope.list[0].push($scope.text);
$scope.k = true;
};
});
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl" >
<input type=button value="add" ng-click="change()" />
<input type=button value="delete" ng-click="changd()" />
<div ng-show="!a && !d" ng-repeat="x in list">
{{x}}
</div>
<div ng-show="d && !a" ng-repeat="x in list">
<input type="checkbox" ng-click="remove($index)">{{x}}
</div>
<div ng-show="a && !d" >
<input type="text" ng-model="text" placeholder="enter the work" /> <input type=button value="add" ng-click="add()" />
<div ng-show="k" ng-repeat="x in list">{{x}}</div>
.
</div>
</div>