I had made two controller in which i had given value by json in the first controller and showed it on the other controller but i want to change the data of json on the page and on clicking update button i want them to show the updated data in the previous page. the first one is the first page with its controller from which i had sended the data on the other page. but i don't know how to update the data of second page and show them in the boxes i had made on the first page..
What I have tried:
<div ng-repeat="obj in data">
<div class="col-sm-3" style="margin-bottom: 4px;">
<div class="BoardCardWithCustomProperties BoardCardWithCustomProperties--hover" draggable="true">
<div class="BoardCardWithCustomProperties-contents">
<img class="BoardCardCoverImage" ng-src={{obj.thumbnail}}>
<div class="BoardCardWithCustomProperties-nameAndDropdownButton">
<div class="BoardCardWithCustomProperties-name">
{{obj.name}}
<a href=""><span class="smallcirclePhoto smallcircle smallcirclecolor" role="img" title="Edit" ng-click="doAction('Edit',obj)">class="fa fa-edit" href="" title="Duplicate"></span></a>
<a href=""><span class="smallcirclePhoto smallcircle smallcirclecolor" role="img" title="Delete" ng-click="doAction('Delete',obj)">^__i class="fa fa-trash"></span></a>
</div>
</div>
</div>
myApp.controller('SampleFlexCntrl', ['$scope', '$http', 'orderProcessService', '$timeout', 'authService', '$routeParams', '$rootScope', 'localStorageService', '$q', 'CommonhttpService', function ($scope, $http, orderProcessService, $timeout, authService, $routeParams, $rootScope, localStorageService, $q, CommonhttpService) {
$scope.doAction = function (action,obj) {
localStorageService.set("formatdata", obj);
window.location = '#/SampleFormat/' + obj.id + "/action/" + action;
}
//Json
$scope.data = [
{
"id": "1",
"Format type": "format",
"name": "Abhishek",
"content": "
A div
",
"thumbnail": "/Images/background-sales.png",
},
{
"id": "2",
"Format type": "format",
"name": "Blauer See",
"content": "
B div
",
"thumbnail": "/Images/background-sales.png"
}
];
}]);
<div class="col-sm-9" style="box-shadow: 2px; box-shadow: 2px 3px 5px 2px rgba(0,0,0,.1); padding-top: 10px;padding-bottom: 2%; transform:translate(12.5%,0%); border-radius: 7px;background:#fff">
<div class="form-group">
<label class="bold-label">{{data.name}}</label>
<button type="button" style="float:right" class="btn btn-sm bg-darkgreen" ng-click="screenshot()">{{action}}</button>
</div>
<div class="col-sm-4">
<div class="form-group">
<label class="settinglabel">Name</label>
<input type="text" maxlength="20" class="form-control" ng-model="data.name">
</div>
</div>
<div class="col-sm-3" style="margin-bottom: 4px;">
<div class="BoardCardWithCustomProperties BoardCardWithCustomProperties--hover" draggable="true">
<div class="BoardCardWithCustomProperties-contents">
<img class="BoardCardCoverImage" ng-src={{data.thumbnail}}>
<div class="BoardCardWithCustomProperties-nameAndDropdownButton">
</div>
</div>
</div>
</div>
myApp.controller('SampleFormatCntrl', ['$scope', '$http', 'orderProcessService', '$timeout', 'authService', '$routeParams', '$rootScope', 'localStorageService', '$q', 'CommonhttpService', function ($scope, $http, orderProcessService, $timeout, authService, $routeParams, $rootScope, localStorageService, $q, CommonhttpService) {
var id = $routeParams.id;
$scope.data = localStorageService.get("formatdata");
$scope.action = $routeParams.action;
if ($scope.action == 'Edit' || $scope.action == 'Copy') {
$scope.action = "Update"
}
else {
$scope.action = "Save"
}
$scope.tinyArray = [];
$scope.screenshot = function () {
$scope.tinyArray.push({
"id": $scope.data.id,
"Name": $scope.data.name,
"content": $scope.data.content,
"thumbnail": $scope.data.thumbnail,
});
}