小编Jet*_*mes的帖子

如何使用 blob 在新选项卡中显示 pdf

我在 TypeScript/Angular 中有这个方法,可以生成我的文件

 imprimir() {

            this.service.emitirAdvertencia({ parametros: [{ name: 'CODIGO', value: 880 }] })
            .subscribe((response) => {
                console.log(response);             
                var fileURL = window.URL.createObjectURL(response);                        

                //this not display my pdf document in a new tab.
                window.open(fileURL, '_blank');

                //this display my document pdf, but in current tab
                window.location.href = fileURL; 
            }, error => {
                console.log(error);
            });
        }
Run Code Online (Sandbox Code Playgroud)

这是我的服务

emitirAdvertencia(parametros: Object): any {
        parametros['dbenv'] = ApplicationContext.getInstance().getDbenv();
        parametros['usuario'] = ApplicationContext.getInstance().getUser().codigoUsuario;
        parametros['nome_relatorio'] = 'RelAdvertenciaDB';
        var httpOptions = {

            headers: new HttpHeaders({
                'Authorization': this.localStorage.get('token'),
            }),
            responseType: 'blob' as …
Run Code Online (Sandbox Code Playgroud)

typescript angular

15
推荐指数
2
解决办法
4万
查看次数

为什么对象数组中的过滤器不适用于打字稿

我有这个方法:

  pesquisar(): void {
    console.log(this.razaoSocial);

    if (this.razaoSocial || this.cnpj) {
      this.empresaDataSource = EMPRESAS.filter(empresa => {
        empresa.razaoSocial.indexOf(this.razaoSocial) > -1
      });
    } else {
      this.empresaDataSource = EMPRESAS;
    }

    console.log(this.empresaDataSource);
  }
Run Code Online (Sandbox Code Playgroud)

razaoSocialcnpj是绑定变量ngModel我的阵列EMPRESA具有两个对象:

export const EMPRESAS:Empresa[]=[
    {id:1, razaoSocial:'Ciclo Cairu', cnpj:'12345678912345'},
    {id:2, razaoSocial:'Industria', cnpj:'789456123456132'}
];
Run Code Online (Sandbox Code Playgroud)

但我应用过滤器,例如:Indus 在html字段中,预计对象Industria已被过滤empresaDataSource,但不是.

控制台中的输出日志是:

> Indus
> []
Run Code Online (Sandbox Code Playgroud)

我的错误在哪里?

javascript typescript angular

1
推荐指数
1
解决办法
42
查看次数

如何从 SQL 查询中提取参数名称

我有一个 SQL 查询

select * from table where field1 = :param1 and field2 = :param2
Run Code Online (Sandbox Code Playgroud)

我想从这个字符串中获取参数名称。例如:[param1, param2]

如何使用 C# 语言做到这一点?

c#

0
推荐指数
1
解决办法
1061
查看次数

标签 统计

angular ×2

typescript ×2

c# ×1

javascript ×1