我的问题与在Chrome浏览器中显示base64编码的PDF文件数据有关。PDF文件不是静态物理文件,而是将其流转换为base64编码的数据。它是一个使用Node.js后端的单页应用程序。pdf文件显示在模式弹出框中,而不是新的选项卡或窗口中。下面是负责显示base64编码的PDF数据的代码:
var objbuilder = '';
objbuilder += ('<object width="100%" height="100%" data="data:application/pdf;base64,');
objbuilder += (r.response);
objbuilder += ('" type="application/pdf" class="internal">');
objbuilder += ('</object>');
var html = '';
html += '<div class="modal fade in" id="linkedDoc" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
html += '<div class="modal-dialog">';
html += '<div class="modal-content" style="height:800px;width:600px;">';
html += '<div class="modal-body" style="height: 100%;" id = "linkedBody">';
html += '<div style="height:25px;clear:both;display:block;">';
html += '<a class="controls previous" href="javascript:void(0);" data-dismiss="modal" aria-hidden="true">Close</a>';
html += '</div></div></div></div></div>';
$('#linkedDoc').remove();
$('body').append(html);
$('#linkedBody').append(objbuilder);
$('.modal').modal({
keyboard: false,
show: true
});
$('.modal-dialog').draggable({ …Run Code Online (Sandbox Code Playgroud) 如果我更改以下代码,这是依赖注入吗
class Needer
{
Needed obj;
AnotherNeeded obj2;
public Needer()
{
obj = new Neede();
obj2 = new AnotherNeede();
}
}
Run Code Online (Sandbox Code Playgroud)
到这个代码
class Needer
{
Needed obj;
AnotherNeeded obj2;
public Needer(Needed param1, AnotherNeeded param2)
{
obj = param1;
obj2 = param2;
}
}
Run Code Online (Sandbox Code Playgroud)