0
我想從我使用angularjs生成的HTML生成PDF,但是當我使用角URL請求(通過requestify)而不是頁面內容時,我得到index.html
頁......沒有人知道如何讓HTML內容的ng-view
從URL加載HTML內容AngularJS
$routeProvider .when('/mediakit/:account', { templateUrl: 'app/mediakit/mediakit.html', controller: 'MediaKitCtrl' });
我想從http://localhost:9000/mediakit/accountid
使用mediakit.html
爲模板不是index.html的內容(其中的內容是內容產生通過ng-view
加載)
我使用生成PDF
let pdf = require('html-pdf');
let requestify = require('requestify');
let outputPath = './server/public/';
//req.body.mediaKitURL --> is the URL that I load the content when I open in the browser
requestify.get(req.body.mediaKitURL).then(function (response) {
// Get the raw HTML response body
let html = response.body; --> //the content here is the content from index.html,
//I would like to get the content from the my angular route that uses mediakit.html (same when I open the URL in the browser)
let config = {format: 'letter'};
// Create the PDF
pdf.create(html, config).toFile(outputPath + '/media_kit_'+req.params.account+'.pdf', function (err, result) {
if (err) return console.log(err);
console.log(result); // { filename: '/pathtooutput/generated.pdf' }
res.status(200).json();
});
});
我希望這是明確的代碼...
這不是我要找的。 –