小编Mel*_*hia的帖子

从 VS Code 登录 Azure 帐户

我有最新版本的 Visual Studio Code 1.19.2。这是一个干净的安装。

我已经使用 Azure 帐户 (0.2.2) 安装了 Microsoft 的 Azure 扩展包。但我无法登录到我的 Azure 订阅。当我在命令面板 (CTRL+Shift+P) 中键入 Azure: Sign In 时,它只在底部紫线中显示 Azure: Logging in...,但没有任何反应。我没有登录。

据我所知,它应该打开带有登录屏幕的浏览器窗口,但事实并非如此。我的默认浏览器是 Edge,我的操作系统是带有所有更新的 Windows 10 Enterprise x64 1709。

如何登录到我的 Azure 订阅?

azure azure-marketplace azure-active-directory visual-studio-code

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

使用Angular-CLI 6.1.2创建新项目时出错

我尝试使用ng new angular-6-boilerplateangular-cli最新版本创建一个新的Angular项目,但我不能再这样做了.我正在使用windows终端来创建我的项目,但是我收到了这个错误.

原理图输入不对Schema进行验证:{"name":"angular-6-boilerplate","version":"6.1.2","newProjectRoot":"projects","skipInstall":false,"linkCli": false,"skipGit":false,"commit":null}错误:

  Data path ".name" should match format "html-selector".
Run Code Online (Sandbox Code Playgroud)

为什么我收到此错误?

typescript angular-cli angular angular6 angular-cli-v6

12
推荐指数
3
解决办法
6912
查看次数

开玩笑的URL.createObjectURL不是一个函数

我正在开发一个reactJs应用程序。我正在开玩笑地测试我的应用程序。我想测试下载blob的功能。

但是不幸的是我收到这个错误:

URL.createObjectURL不是函数

我的测试功能:

describe('download', () => {
    const documentIntial = { content: 'aaa' };
    it('msSaveOrOpenBlob should not have been called when navigao is undefined', () => {
      window.navigator.msSaveOrOpenBlob = null;
      download(documentIntial);
      expect(window.navigator.msSaveOrOpenBlob).toHaveBeenCalledTimes(0);
    });
  });
Run Code Online (Sandbox Code Playgroud)

我要测试的功能:

export const download = document => {
  const blob = new Blob([base64ToArrayBuffer(document.content)], {
    type: 'application/pdf',
  });
  if (window.navigator && window.navigator.msSaveOrOpenBlob) {
    window.navigator.msSaveOrOpenBlob(blob);
    return;
  }

  const fileURL = URL.createObjectURL(blob);
  window.open(fileURL);
};
Run Code Online (Sandbox Code Playgroud)

javascript testing blob reactjs jestjs

12
推荐指数
6
解决办法
7723
查看次数

React 脚本问题:循环加载 chunk.js

我正在使用 React 脚本 v3。每当我在页面(鼠标事件,表单...)中执行操作时,我都会遇到此问题,应用程序会不断下载chunk.js

在此处输入图片说明

这是我的package.json

{
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "bootstrap": "^4.3.1",
    "cors": "^2.8.5",
    "lodash.flatten": "^4.4.0",
    "lodash.get": "^4.4.2",
    "lodash.intersection": "^4.4.0",
    "mockdate": "^2.0.2",
    "moment": "^2.24.0",
    "prop-types": "^15.7.2",
    "react": "^16.8.6",
    "react-app-polyfill": "^1.0.1",
    "react-dom": "^16.8.6",
    "react-router": "4.3.1",
    "react-router-dom": "4.3.1",
    "react-scripts": "^3.0.1",
    "recompose": "^0.30.0",
    "url-search-params-polyfill": "^6.0.0",
    "uuid": "^3.3.2"
  },
  "scripts": {
    "mocks": "cd mocks && npm start",
    "start-dotnet": "react-scripts start",
    "start": "concurrently \"npm run mocks\" \"react-scripts start\"",
    "build": "react-scripts build",
    "test": "set NODE_ICU_DATA=node_modules/full-icu&& react-scripts test --env=jsdom",
    "test:staged": "npm …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs webpack

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

angular2打印json来自服务

我不知道如何从我的模板中打印JSON数据

如果我在模板中使用:template:people: {{people}}或template:people: {{articles}}
总是进入浏览器:

人物:[object Object]

如果我在模板中使用:template:people: {{people.totalrecords}}或template:people: {{articlestotalrecords}}

得到空白值:人:

import {bootstrap} from 'angular2/platform/browser';
import {Component, enableProdMode, Injectable, OnInit} from 'angular2/core';
import {Http, HTTP_PROVIDERS, URLSearchParams} from 'angular2/http';
import 'rxjs/add/operator/map';
import {enableProdMode} from 'angular2/core';

@Injectable()
class ArticleApi {
  constructor(private http: Http) {}
  getData: string;

  seachArticle(query) {
    const endpoint = 'http://xdemocrm.com/webservicecrm.php';
    const searchParams = new URLSearchParams()
    searchParams.set('object', 'account');
    searchParams.set('action', 'list');   
    return this.http
      .get(endpoint, {search: searchParams})
      .map(res => res.json())
  }

  postExample(someData) {
    return this.http
      .post('https://yourEndpoint', JSON.stringify(someData)) …
Run Code Online (Sandbox Code Playgroud)

json typescript angular

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

Angular Material,Md-datepicker-输入单击时打开日期选择器

我想打开日历,不仅用户单击日历图标,而且单击输入字段时,用户都可以从日期选择器中选择日期。物料DatePicker。因此,我为此创建了指令,将其附加到输入,<md-datepicker>并监视(click)输入事件:

HTML:

  <md-form-field class="field-half-width">
    <input mdInput [mdDatepicker]="picker2" placeholder="Galioja iki"
            formControlName="dateUntil" (click)="clickInp()">
    <md-datepicker-toggle  id="calendar" mdSuffix [for]="picker2" ></md-datepicker-toggle>
    <md-datepicker #picker2 manualClickRenderer></md-datepicker>
  </md-form-field> 
Run Code Online (Sandbox Code Playgroud)

表单组件:

import {ManualClickRerender} from '../shared/directives/manual-click.directive';

@Component({
  selector: 'form',
  providers: [ManualClickRerender]
})

export class FormComponent implements OnInit, OnChanges {
 ...
  clickInp() {
    this.manualClickRerender.botClick();
  }
Run Code Online (Sandbox Code Playgroud)

指示:

import { Directive, Renderer, ElementRef } from '@angular/core';
@Directive({
  selector: '[manualClickRenderer]'
})
export class ManualClickRerender {

  private nativeElement : Node;

  constructor( private renderer : Renderer, private element : ElementRef ) …
Run Code Online (Sandbox Code Playgroud)

javascript typescript angular-material angular-material2 angular

8
推荐指数
4
解决办法
7677
查看次数

node_modules 文件夹内的文件出现 [TS] 错误

我只是想使用 webpack5 和 webpack-cli 启动一个新的 typescript 项目。令我惊讶的是,我收到了这些错误:

错误:

hha@melchia ~/projects/project $ npm run build

> my-webpack-project@1.0.0 build /home/hha/projects/project
> webpack

99% done plugins watchInfo[webpack-cli] Compilation finished
asset main.js 4.7 KiB [compared for emit] (name: main)
runtime modules 668 bytes 3 modules
./src/index.ts 616 bytes [built] [code generated]

ERROR in /home/hha/projects/project/node_modules/webpack/lib/javascript/JavascriptParser.js
[tsl] ERROR in /home/hha/projects/project/node_modules/webpack/lib/javascript/JavascriptParser.js(3272,7)
      TS2578: Unused '@ts-expect-error' directive.

ERROR in /home/hha/projects/project/node_modules/webpack/lib/ProgressPlugin.js
[tsl] ERROR in /home/hha/projects/project/node_modules/webpack/lib/ProgressPlugin.js(392,4)
      TS2578: Unused '@ts-expect-error' directive.

ERROR in /home/hha/projects/project/node_modules/webpack/lib/optimize/ConcatenatedModule.js
[tsl] ERROR in /home/hha/projects/project/node_modules/webpack/lib/optimize/ConcatenatedModule.js(1470,6)
      TS2578: Unused '@ts-expect-error' directive. …
Run Code Online (Sandbox Code Playgroud)

javascript typescript webpack webpack-cli

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

从Cloud Firestore加载MatDatepicker中的时间戳 火力地堡

不加载从Cloud Firestore返回的日期.

在我将依赖关系更新package.json到最新版本之后,我的更改对Angular 6中的应用程序产生了很大影响.

我无法将Timestamp类型的值加载到Cloud Firestore返回的DatePicker类型的字段中.

在升级之前,我返回了一个类型的对象,Date ()并在更新后返回Cloud Firestore Timestamp.

我相信此更新中Firebase返回的类型有一些变化.

Datepicker字段必须接收一个Date ()对象,而不是一个Timestamp.

我必须遍历从Cloud Firestore返回的所有记录,并调用该toDate ()方法来获取Date ()对象并将其加载到DatePicker中.

有没有办法将Datepicker的类型更改为Timestamp?否则,我无法从Cloud Firestore收到Timestamp类型的值.

在此输入图像描述

的package.json:

{
  "name": "myapp",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --open",
    "start-hmr": "ng serve --hmr -e=hmr -sm=false",
    "start-hmr-sourcemaps": "ng serve --hmr -e=hmr",
    "build": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev",
    "build-stats": "node --max_old_space_size=6144 ./node_modules/@angular/cli/bin/ng build --dev --stats-json",
    "build-prod": …
Run Code Online (Sandbox Code Playgroud)

javascript firebase typescript angular-material angular

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

Service Worker over http:获取脚本时发生 SSL 证书错误

我正在为我的 angular 4 项目使用带有 https 而不是 https 的服务工作者。但我收到此错误: Service Worker 注册失败:DOMException:无法注册 ServiceWorker:获取脚本时发生 SSL 证书错误。

这是我的 service-worker.js

module.exports = {
    navigateFallback: '/index.html',
    stripPrefix: 'dist',
    root: 'dist/',
    staticFileGlobs: [
        'dist/index.html',
        'dist/**.js',
        'dist/**.css',
        'dist/assets/image/**.*',
        'dist/assets/image/client-home-carousel/**.*',
    ]
};
Run Code Online (Sandbox Code Playgroud)

angular-cli.json 中的一个:

"assets": [
            "assets",
            "favicon.ico",
            "service-worker.js"
        ],
Run Code Online (Sandbox Code Playgroud)

https http service-worker angular

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

Angular 5 + Popper.JS

我正在尝试启动需要Popper.Js功能的培训项目.但是,它似乎并没有让我开始使用Popper.Js.

根据Bootstrap的文档,我开始使用Popper.Js

$(function () {
  $('[data-toggle="tooltip"]').tooltip();
});
Run Code Online (Sandbox Code Playgroud)

我在主要组件中使用它ngOnInit.但是,它不起作用.发生错误" 属性'工具提示'在类型'JQuery'上不存在 ".我导入了jquery和bootstrap包文件.安装所有库的类型.

我也试过纯粹的"popper.js"而不是bootstrap.bundle.js.但是会发生同样的错误.Bootstrap.bundle.js(包括正确顺序的bootstrap和popper.js)和jquery在angular-cli.json中导入.

javascript twitter-bootstrap typescript angular angular5

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