gpt4 book ai didi

angularjs - Wkhtmltopdf 用 angularjs 修补了 QT 问题

转载 作者:行者123 更新时间:2023-12-04 17:53:29 24 4
gpt4 key购买 nike

在运行带有补丁 Qt 的任何版本的 wkhtmltopdf 时,我得到这个 JavaScript 错误:

Warning: undefined:0 Error: [$injector:modulerr] Failed to instantiate module ng due to:
'undefined' is not an object
http://errors.angularjs.org/1.5.7/$injector/modulerrp0=ng&p1='undefined'%20is%20not%20an%20object

(我正在尝试使用 angularjs 1.5 呈现页面)。

当我使用未打补丁的 Qt 版本的 wkhtmltopdf 时,我没有收到错误并且一切正常。

我使用 this heroku buildpack它安装了带有补丁 Qt 的 0.12.3 版,我收到了这个错误。

知道如何解决我的问题吗?我可以安装 wkhtmltopdf 而无需在生产环境中修补 Qt,但似乎我必须编译它...

最佳答案

我终于设法让它适用于所有版本:我需要一个特殊版本的 .bind() JavaScript 函数 polyfill:

var isFunction = function (o) {
return typeof o == 'function';
};

var bind,
slice = [].slice,
proto = Function.prototype,
featureMap;

featureMap = {
'function-bind': 'bind'
};

function has(feature) {
var prop = featureMap[feature];
return isFunction(proto[prop]);
}

// check for missing features
if (!has('function-bind')) {
// adapted from Mozilla Developer Network example at
// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
bind = function bind(obj) {
var args = slice.call(arguments, 1),
self = this,
nop = function() {
},
bound = function() {
return self.apply(this instanceof nop ? this : (obj || {}), args.concat(slice.call(arguments)));
};
nop.prototype = this.prototype || {}; // Firefox cries sometimes if prototype is undefined
bound.prototype = new nop();
return bound;
};
proto.bind = bind;
}

关于angularjs - Wkhtmltopdf 用 angularjs 修补了 QT 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38201136/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com