小编Ade*_*rsh的帖子

AngularJS HTTP发布到PHP

我使用如下所示的方法phpangularjs控制器向页面发布一些数据$http.

$scope.login = function(){
    var data = {
        'username' : $scope.username,
        'password' : $scope.password
    };
    $http.post('login.php', data).success(function(response){
        console.log(response);
    });
};
Run Code Online (Sandbox Code Playgroud)

我知道我可以php使用以下方法检索此数据:

$postdata = json_decode(file_get_contents('php://input'), true);
Run Code Online (Sandbox Code Playgroud)

但我想知道是否有更好的方法,angularjs所以我可以使用simple $_POSTin php来检索数据.

jQuery我们可能只是简单地使用$.post那些可用于php$_POST.为什么angularjs这不那么简单.有没有什么办法来填充$_POSTphp,当我们做$http post的请求angularjs.请帮忙.

php jquery post angularjs

4
推荐指数
1
解决办法
4448
查看次数

dompdf - 仅在第一页之后设置页边距

我将一个HTMLpdf使用文件dompdf。它工作正常。但问题是我需要为第一页之外的所有页面设置页边距。第一页应该有一个覆盖整个页面的图像。但是现在包括第一页在内的所有页面的边距都来了。

我无法禁用第一页的边距。任何帮助是极大的赞赏。提前致谢。

下面是我的css

  <style type="text/css">
    body { margin: 0px; }
    @page { margin: 50px; }
    #header { 
      position: fixed; 
      left: 0px; 
      top: -52px;
      height: 50px; 
      border-bottom: 2px solid #797979;
      margin: 0; 
    }
    #footer { 
      position: fixed; 
      left: 0px; 
      bottom: -52px;
      height: 50px; 
      border-top: 2px solid #797979;
      margin: 0; 
    }
    #footer .page:after { content: counter(page); }
    .firstpage { 
      position: absolute;
      page-break-after: always; 
      top: -50px;
      width: 100%;
      margin: 0;
    }
    .otherpages{ margin: …
Run Code Online (Sandbox Code Playgroud)

html css php dompdf

3
推荐指数
1
解决办法
5889
查看次数

在AngularJS控制器中使用jQuery函数

我需要jQuery在所有元素上初始化一个插件,该插件具有一个ng-repeat循环内部的某个类名.这些元素通过angularjs $http get方法加载.

var app = angular.module('myApp', []);

app.controller('myController', function($scope, $http) {
    $http.get('get_item.php').success(function(response) {
        $scope.items = response;
        angular.element('.make-switch').bootstrapSwitch(); // jQuery plugin code
    });
});
Run Code Online (Sandbox Code Playgroud)

但这不起作用.我$('.make-switch').bootstrapSwitch();也试过了.请帮忙.

jquery angularjs

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

angularjs ×2

jquery ×2

php ×2

css ×1

dompdf ×1

html ×1

post ×1