Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/245.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 已从服务中的控制器获取值_Javascript_Php_Angularjs_Service_Controller - Fatal编程技术网

Javascript 已从服务中的控制器获取值

Javascript 已从服务中的控制器获取值,javascript,php,angularjs,service,controller,Javascript,Php,Angularjs,Service,Controller,我想获取在服务中获取的值,该值在控制器中传递,并将其传递到php页面。$scope.Album值从控制器中推出。现在我在varget\u save\u album中获取它并加载到本地存储服务中。我想直接获取它,而不需要本地存储,并将其保存到php页面 controller.js: $scope.savealbum = function () { $scope.getAlbum = AlbumServices.get_album(); $scope.Album = { .... v

我想获取在服务中获取的值,该值在控制器中传递,并将其传递到php页面。
$scope.Album
值从控制器中推出。现在我在var
get\u save\u album
中获取它并加载到本地存储服务中。我想直接获取它,而不需要本地存储,并将其保存到php页面

controller.js:

$scope.savealbum = function () {
  $scope.getAlbum = AlbumServices.get_album();
  $scope.Album = {
    .... value....
  };
  if ($scope.getAlbum === null) {
    $scope.initalPush.push($scope.Album);
    AlbumServices.save_album($scope.initalPush);
  } else {
    $scope.getAlbum.push($scope.Album);
    AlbumServices.save_album($scope.getAlbum);
  }
  alert('Album Added Successfully');
  $location.path('/album_list');
};
JavaScript:

get_album: function () {
  var get_save_album = JSON.parse(localStorage.getItem('album'));
  $http.post('js/data/album.php',get_save_album)
    .success(function (data, status, headers, config)
    {
      console.log(status + ' - ' + data);                 
    })
    .error(function (data, status, headers, config)
    {                   
      console.log('error');
    });

  return get_save_album;
}