$scope.post1 = angular.fromJson(window.localStorage['like'] || '{}');
var like ={
id:''+id
};
$scope.post1.push(like);
window.localStorage['like'] = angular.toJson( $scope.post1);
When I run this code it gives $scope.post1.push is not a function..How to solve this problem?
window.localstorage. that should give you some clues. Useangular.isArray(window.localstorage['like']);