Angular-ui模态和phalcon,错误从$ http发送数据到模态控制器

时间:2017-04-11 17:40:56

标签: angularjs angularjs-directive angular-ui-bootstrap phalcon

我正在使用angular-ui模态指令。 并试图从我的phalcon控制器获取数据,但我收到一个错误:

Fatal error: Uncaught Error: Access to undeclared static property: Phalcon\Di::$_default in C:\xampp\htdocs\cofiso\app\library\Base\Services.php:9 Stack trace: #0 [internal function]: Phalcon\Di->__construct() #1 C:\xampp\htdocs\cofiso\app\library\Base\Services.php(9): Phalcon\Di\FactoryDefault->__construct() #2 C:\xampp\htdocs\cofiso\public\index.php(25): Base\Services->__construct(Object(Phalcon\Config\Adapter\Ini)) #3 {main} Next Error: Access to undeclared static property: Phalcon\Di::$_default in C:\xampp\htdocs\cofiso\app\library\Base\Services.php on line 9

这是我的代码:

$scope.edit_prest = function(index){

 var idCell = $scope.prestamos[index];

    ServicesPost.getPrestamo(idCell).then(function(data){
        $scope.promesa = data;
    },function(error){
        alert(error);
    });

    $scope.items = [$scope.Cliente,$scope.id,$scope.Tasa];

    var modalInstance = $modal.open({
                templateUrl: 'prestamo/edit/'+idCell,
                controller: 'InstanceCtrl_Edit',
                 size: 'lg',
                resolve: {
                    items: function () {                        
                      return $scope.items;
                    },

                    cliente: function(){
                        return $scope.promesa;  //ServicesPost.getPrestamo(idCell);
                    }
                }
    });


}

和我的工厂服务邮件:

myApp.factory('ServicesPost', function($http) {
  var myService = {
      getPrestamo: function(idCell){


      var promesa = $http({
        method: 'POST',
        url: 'prestamo/dataPrestamo',
        data: "idCell="+idCell
      }).then(function successCall(response) {

        return response.data;

      }, function errorCall(error){
         console.log(error);
    });

   return promesa;

     }
   };
 return myService;
});

我的模态总是显示此错误:(点击链接中的img即可看到错误)

Message in the modal, it's an error of phalcon (click here)

这是我的代码PHP:

public function dataPrestamoAction(){
if($this->request->isPost() == true){

    $this->view->disable();
    $idperfil = $this->request->getPost("idperfil");

    $this->response->setJsonContent(array('data' => $idperfil));
    $this->response->setStatusCode(200, "OK POST EDIT PRESTAMO");
    $this->response->send();
}

}

next:这里应该显示.volt视图

public function editAction($idprestamo)
{
 if($this->request->isGet() == true){

    $this->view->setRenderLevel(
        View::LEVEL_ACTION_VIEW
    ); 


 }
}

这是我的代码请求我的文件Base / Service.php

我实际上不知道从Base / Service.php代码中改变什么

作为一名程序员,我付出了巨大的努力去理解,我说西班牙语并且它有点复杂,因为所有的代码都是英文的。

欢迎任何帮助。谢谢。 请原谅我糟糕的英语。     

  namespace Base;

 class Services extends \Phalcon\DI\FactoryDefault
{
  public function __construct($config)
  {
    parent::__construct();

    $this->setShared('config', $config);
    $this->bindServices();
}

protected function bindServices()
{
    $reflection = new \ReflectionObject($this);
    $methods = $reflection->getMethods();

    foreach ($methods as $method) {

        if ((strlen($method->name) > 10) && (strpos($method->name, 'initShared') === 0)) {
            $this->set(lcfirst(substr($method->name, 10)), $method->getClosure($this));
            continue;
        }

        if ((strlen($method->name) > 4) && (strpos($method->name, 'init') === 0)) {
            $this->set(lcfirst(substr($method->name, 4)), $method->getClosure($this));
        }

    }

}
}

打算在几天内解决这个错误。

是的,请有人帮助我。感谢。

我希望这很好。在此先感谢您的帮助。

0 个答案:

没有答案