Angularjs Angular ui modal和phalcon,从$http向modal控制器发送数据时出错
我使用的是AngularUI模态指令。 并试图从我的phalcon控制器获取数据,但我得到一个错误:Angularjs Angular ui modal和phalcon,从$http向modal控制器发送数据时出错,angularjs,angularjs-directive,angular-ui-bootstrap,phalcon,Angularjs,Angularjs Directive,Angular Ui Bootstrap,Phalcon,我使用的是AngularUI模态指令。 并试图从我的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->
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来查看错误)
以下是我的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();
}
}
下一步:这里应该显示.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));
}
}
}
}
欢迎任何帮助。感谢
请原谅我英语不好。
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));
}
}
}
}
并打算在几天内解决这个错误
谁能帮帮我吗。谢谢
我希望这是好的。提前感谢您的帮助。PHP代码出现错误,而Angular代码出现错误,因此也发布您的PHP代码。我认为这是一个已经解决的问题。你能下载最新的Phalcon版本并再试一次吗?这有点奇怪,因为当他评论一个版本时,只有一个正常版本有效。也就是说,如果我只放置对话框,则“正常”会显示没有错误的内容,如果您只放置“正常”factory服务,则会显示没有错误的数据,如果我同时放置这两个对话框,则会出现问题错误。这就是为什么我认为这不是php的问题。但我会把它放在这里,如果我使用的是phalcon的更新版本。如果有解决了问题的帖子,我会提供所需的一切,但不会解决我的问题。请从Base/Services.php粘贴代码