小编Jer*_*zka的帖子

如何在动态创建的组件中使用Output

我正在使用此技术动态创建组件:

import {
 Component, Input, ViewContainerRef, ViewChild, ReflectiveInjector,    ComponentFactoryResolver,
 Output, EventEmitter
 } from '@angular/core';

 @Component({
 selector: 'dynamic-component',
 template: `
 <div #dynamicComponentContainer></div>
 `,
 })
 export default class DynamicLayerComponent {
 currentComponent = null;

 @ViewChild('dynamicComponentContainer', { read: ViewContainerRef })     dynamicComponentContainer: ViewContainerRef;
 @Output() visibility = new EventEmitter<boolean>();

// component: Class for the component you want to create
// inputs: An object with key/value pairs mapped to input name/input value
@Input() set componentData(data: {component: any, inputs: any }) {
console.log('setting');
if (!data) {
  return;
} …
Run Code Online (Sandbox Code Playgroud)

typescript angular

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

无法在HTTP请求中插入任何正文

当我尝试在HTTP请求的主体中输入任何内容时,当我点击其他任何内容时,我得到:

您无法切换,因为数据无法转换为Target选项卡数据,空数据要切换

那是什么 ?我正在运行Windows 10.

jmeter

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

Gitlab 中构建失败的工件

我想知道如何在 gitlab 持续集成中为失败的构建生成工件,以查看构建生成的 html 报告。

我试过这样:

 artifacts:
    when: on_failure
      paths:
        - SmokeTestResults/
        - package.json
Run Code Online (Sandbox Code Playgroud)

但不幸的是它不起作用。我正在使用 Gitlab 8.11.4 社区版。

gitlab gitlab-ci gitlab-ci-runner

9
推荐指数
2
解决办法
7391
查看次数

小袋鼠和原型错误

问题是原型未定义,尽管在节点控制台中编写http.IncomingMessage.prototype确实将对象作为输出.有任何想法吗 ?

var req = Object.create(http.IncomingMessage.prototype)


Uncaught TypeError: Cannot read property 'prototype' of undefined
at http://localhost:62625/____wallaby-bundle.js?1501265946287&wallabyFileId=bundle:219253
Run Code Online (Sandbox Code Playgroud)

javascript node.js typescript wallaby.js angular

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

如何模拟 JEST 中 SUT 中使用的方法上使用的装饰器函数

我有一个打字稿课程:

\n\n
export class SystemUnderTest {\n\n  @LogThisAction('sth was done')\n  public doSomething() {} \n\n}\n
Run Code Online (Sandbox Code Playgroud)\n\n

正如您所看到的,它使用反射来执行一些装饰函数:

\n\n
 export declare function LogThisAction(action: string): (target: any) => \n void;\n
Run Code Online (Sandbox Code Playgroud)\n\n

当我运行测试时,我不关心实际的实现。这个装饰器函数,所以我尝试像这样模拟它:

\n\n
 myModule = require(./DecoratorFunctions);\n myModule.LogThisAction = jest.fn();\n
Run Code Online (Sandbox Code Playgroud)\n\n

但这似乎不起作用。当我运行测试时我得到:

\n\n
\xe2\x97\x8f Test suite failed to run\nTypeError: decorator is not a function\nat DecorateProperty (node_modules/reflect-metadata/Reflect.js:553:33)\n
Run Code Online (Sandbox Code Playgroud)\n\n

如何在JEST框架中实现我的目标?

\n

javascript typescript jestjs

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

typescript tsc 不排除@types/corejs

配置:

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true,
"lib": [
  "es6",
  "dom"
],
"types": [
  "hammerjs",
  "jasmine",
  "node",
  "selenium-webdriver",
  "webpack",
  "core-js",
  "google-maps"
]
},
"exclude": [
"node_modules"
"e2e"
],
"include": [
"src/**/*"
],
"filesGlob": [
"./src/**/*.ts",
"./test/**/*.ts",
"!./node_modules/**/*.ts",
"./src/custom-typings.d.ts"
],

}
Run Code Online (Sandbox Code Playgroud)

执行 tsc 时出现以下错误:

node_modules/@types/core-js/index.d.ts(262,5): 错误 TS2687: 'flags' 的所有声明必须具有相同的修饰符。node_modules/@types/core-js/index.d.ts(276,5): 错误 TS2687: 'EPSILON' 的所有声明必须具有相同的修饰符。node_modules/@types/core-js/index.d.ts(311,5): 错误 TS2687: 'MAX_SAFE_INTEGER' 的所有声明必须具有相同的修饰符。node_modules/@types/core-js/index.d.ts(318,5): 错误 TS2687: 'MIN_SAFE_INTEGER' 的所有声明必须具有相同的修饰符。node_modules/@types/core-js/index.d.ts(457,5): 错误 TS2403: 后续变量声明必须具有相同的类型。变量 '[Symbol.toStringTag]' 的类型必须为 '"Symbol"',但这里的类型为 'string'。node_modules/@types/core-js/index.d.ts(457,5): 错误 TS2687: '[Symbol.toStringTag]' 的所有声明必须具有相同的修饰符。node_modules/@types/core-js/index.d.ts(464,5): …

javascript typescript tsc

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

如何在冒号属性名称中选择具有特定字符串的NOT元素

我有几个像这样的元素:

<g transform="matrix">
   <image xlink:href="data:image/png" width="48">
</g>
<g transform="matrix">
   <image xlink:href="specyfic" width="48">
</g>
<g transform="matrix">
   <image xlink:href="specyfic" width="48">
</g>
Run Code Online (Sandbox Code Playgroud)

我想选择名称中没有'specifiedc'的元素.问题是,有时会有一些NOT元素,有时甚至没有.NON specyfic图像计数始终是一个.

由于属性名称中的':',我无法实现这一点.

我试过这个:

  public static getEventIconOnMap: ElementFinder = 
   element.all(by.css('image[width="48"]:not(image[xlink\\:href*="specyfic"'))).last();
Run Code Online (Sandbox Code Playgroud)

html css webdriver typescript protractor

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

JMeter 使随机数返回浮点数

我有这个:

  "latitude": ${__Random(-85,85)},
  "longitude": ${__Random(-180,180)},
Run Code Online (Sandbox Code Playgroud)

我想要这个:

  "latitude": ${__Random(42.06,42.08)},
  "longitude": ${__Random(20.02,20.04)},
Run Code Online (Sandbox Code Playgroud)

但它不起作用。如何将其更改为 42.06 - 42.08 和 20.02 和 20.04 之间的随机数?

testing jmeter performance-testing

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