http://plnkr.co/edit/xUDrOS?p=preview
I want to make my code like this how can I push array in this so that i can edit my data in-line as well as add new data also. and also I want to add some labels when we add or edit fields but not want to show them when the data is displayed
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
</head>
<body>
<div ng-app="myApp">
<div ng-controller="ClickToEditCtrl">
<div ng-hide="editorEnabled">
{{title}}<br/> {{name}}
<a href="#" ng-click="enableEditor()"><img src="pencil.jpg" style=" height: 20px;"/></a>
</div>
<div ng-show="editorEnabled">
<input ng-model="editableTitle" ng-show="editorEnabled"><br/>
<input ng-model="editableName" ng-show="editorEnabled">
<a href="#" ng-click="save()"><img src="save.png" style=" height: 20px;"/></a>
<a href="#" ng-click="disableEditor()"><img src="cancel.png" style=" height: 20px;"/></a>.
</div>
</div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('ClickToEditCtrl',function($scope) {
$scope.title = "Hi! I am aashima";
$scope.name = "aashima";
$scope.editorEnabled = false;
$scope.enableEditor = function() {
$scope.editorEnabled = true;
$scope.editableTitle = $scope.title;
$scope.editableName = $scope.name;
};
$scope.disableEditor = function() {
$scope.editorEnabled = false;
};
$scope.save = function() {
$scope.title = $scope.editableTitle;
$scope.name = $scope.editableName;
$scope.disableEditor();
};
});
</script>
</body>
</html>