2016-07-05 15 views
1

ich diesen JavaScript-Fehler, wenn eine beliebige Version von wkhtmltopdf mit gepatchten Qt läuft:wkhtmltopdf gepatcht QT Problem mit AngularJS

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 

(Ich versuche, eine Seite mit AngularJS 1.5 zu machen).

Wenn ich eine Version von wkhtmltopdf ohne Patched Qt verwende, bekomme ich den Fehler nicht und alles funktioniert gut.

Ich verwende this heroku buildpack, die Version 0.12.3 mit gepatcht Qt installiert, und ich habe diesen Fehler.

Irgendeine Idee, wie man mein Problem löst? Ich kann wkhtmltopdf ohne Patched Qt auf Produktion installieren, aber es scheint, dass ich es kompilieren muss ...

Antwort

7

Ich schaffte es endlich, es mit allen Versionen arbeiten: Ich brauchte eine spezielle Version der .bind() JavaScript-Funktion 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; 
} 
+0

Große Lösung! – Tommie

+0

Ich bin auch auf der gleichen Seite, wo soll ich das hinstellen? –

+0

hast du den Polyfill, den ich in deinem HTML gepostet habe, abgelegt? – Nanocom