小编aaa*_*x10的帖子

如何按类,id,选择器和属性获取DOM元素

如何通过类,id,selectors(div > .my-i)和jQuery中的属性获取DOM元素?

例如:

<div class="myClass" style="width:200px">
<span id="pop">test</span>
<div>
  <i>aaa</i>
  <i class="my-i">bbb</i>
  <i class="my-i">ccc</i>
</div>
Run Code Online (Sandbox Code Playgroud)

我需要得到:

  1. 价值200px分类
  2. id的文本'test'
  3. 所有按类="my-i"

什么是最好的方式?

angular

20
推荐指数
1
解决办法
6万
查看次数

如何发送外部文件,只使用url(https:// .....)

我在尝试:

  .post("/getAttachments", (req, res, next) => {
    repository.getAttachments(req.body)
      .then((attachment) => {
        return res.sendFile('https://host.com' + attachment.req.path);            
      })
      .catch(next);
  })
///clientService:
 function getAttachments(params) {
      return $http.post(baseUrl + "/getAttachments", params, {responseType: 'arraybuffer'}).success(function (data) {
        let blob  = new Blob([data], {type: 'application/vnd.ms-excel'});
        saveAs(blob);
      });
    };
Run Code Online (Sandbox Code Playgroud)

所有都适用于本地文件.你能帮忙吗?

blob node.js express

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

如何为角度5 / nodejs启用Access-Control-Allow-Origin?

阅读包括“ Access-Control-Allow-Origin”在内的许多方法,但没有一种对我有用。

我使用@ angular / common / http模块和外部url作为数据源。通过尝试获取数据来获取错误:///// .................

Failed to load http://accounts.......com/accounts: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 503.
Run Code Online (Sandbox Code Playgroud)


account.service.ts:

Failed to load http://accounts.......com/accounts: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 503.
Run Code Online (Sandbox Code Playgroud)

app.module.ts

import { Injectable                    } from '@angular/core';
import { Router                        } from '@angular/router';
import { HttpClient, …
Run Code Online (Sandbox Code Playgroud)

http node.js webpack-dev-server angular angular5

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

标签 统计

angular ×2

node.js ×2

angular5 ×1

blob ×1

express ×1

http ×1

webpack-dev-server ×1