Hey everyone, I've created a form that should open when clicking on the "Edit Button". However, when I try to edit the form and click on the "Save" button, it doesn't save the data. Can someone please help me with this issue?
Code
// Here is the code
var app = angular.module('theme', []);
app.controller('portfolioController', function($scope) {
$scope.portofoliosBox = [{
title: "Finance Projects",
description: "# of projects Count Sum Aggregate 1"
}, {
title: "Marketing Projects",
description: "# of projects Count Sum Aggregate 2"
}, {
title: "Finance Projects",
description: "# of projects Count Sum Aggregate 3"
}, {
title: "Marketing Projects",
description: "# of projects Count Sum Aggregate 4"
}, {
title: "Finance Projects",
description: "# of projects Count Sum Aggregate 5"
}];
$scope.editFormPortFolio = function(portfolioBox) {
editFormPorfolio = true;
portfolioBox.title = portfolioBox.title;
portfolioBox.description = portfolioBox.description;
}
});
HTML Code
<body ng-app="theme">
<div ng-controller="portfolioController">
<div ng-repeat="portfolioBox in portofoliosBox">
<button ng-click="editFormPorfolio=true" ng-show="!editFormPorfolio">Edit Button</button>
<h5 ng-show="!editFormPorfolio">{{portfolioBox.title}}</h5>
<p ng-show="!editFormPorfolio">{{portfolioBox.description}}</p>
<form ng-show="editFormPorfolio" ng-submit="editFormPortFolio(portfolioBox)">
<label class="edit-pencil">
<button>Save</button>
<input type="submit" ng-show />
</label>
<input type="text" ng-model="portfolioBox.title" />
<textarea row="5" cols="" ng-model="portfolioBox.description"></textarea>
</form>
</div>
</body>