我使用如下所示的方法php从angularjs控制器向页面发布一些数据$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这不那么简单.有没有什么办法来填充$_POST的php,当我们做$http post的请求angularjs.请帮忙.
我将一个HTML以pdf使用文件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) 我需要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();也试过了.请帮忙.