小编Iva*_*ers的帖子

ng2-charts - 无法绑定到"数据集",因为它不是"基础图表"的已知属性

版本:Cordova:6.3.1,Gulp CLI:1.2.2,离子框架:2.0.0-rc.0,Ionic CLI版本:2.1.0


我在ionic2应用程序中使用ng2-charts.

进口不受import {ChartsModule} from "ng2-charts"; 而是import {ChartsModule} from "ng2-charts/components/charts/charts;"因为这个(问题#440)

我的整个app.module.ts

import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { ChartsModule } from 'ng2-charts/components/charts/charts';

import { MyApp } from './app.component';
import { EventsPage } from '../pages/events/events.component';
import { ChartComponent } from '../pages/chart/chart.component';
import { APICaller } from '../services/APICaller.service';
import { EventDetailComponent } from '../pages/event-detail/event-detail.component';
import { ParticipantDetail } from '../pages/participant-detail/participant-detail.component';
import { ParticipantFeedComponent } from …
Run Code Online (Sandbox Code Playgroud)

ionic2 ng2-charts angular

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

Angular2 - 在另一个Observable中使用Observable返回方法的值

问题

我不知道如何使用getUserHeaders()我当前返回的Observable的值http.get.

当前错误

Type 'Observable<void>' is not assignable to type 'Observable<Participant[]>'

预期结果

能够使用我的Observable返回方法的值getUserHeaders()作为调用中的headers属性http.而只返回http调用的Observable.

以前的代码

(使用由getUserHeaders()(不是Observable或者Promise)返回的harcoded Headers .

getAllParticipants(): Observable<Array<Participant>> {
    return this.http.get('someUrl',
                {headers: this.getUserHeaders()})
           .map(response => {
               return response.json();
        });
    });
   }
Run Code Online (Sandbox Code Playgroud)

目前的代码

通过使用TypeScript的答案从Angular2中的http数据链接RxJS Observables,我来到了该flatMap方法.(注意此代码当前抛出'当前错误')

getUserHeaders(): Observable<Headers> {
        let headers: Headers = new Headers();

        return NativeStorage.getItem("user").map(
            data => {
                headers.append('API_KEY', data.json().apiKey);
                headers.append('DEVICE_ID', data.json().deviceId);
                return …
Run Code Online (Sandbox Code Playgroud)

observable rxjs typescript ionic2 angular

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

Docker - 在HTTPS上运行Jetty

我正在尝试使用SSL配置我的Jetty.现在我只是坚持为什么它不能在HTTPS上连接.它在HTTP上工作正常.

$ {} JETTY_HOME /etc/jetty-https.xml

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/config
ure_9_3.dtd">

<!-- ============================================================= -->
<!-- Configure a HTTPS connector.                                  -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- and jetty-ssl.xml.                                            -->
<!-- ============================================================= -->
<Configure id="sslConnector" class="org.eclipse.jetty.server.ServerConnector">

  <Call name="addIfAbsentConnectionFactory">
    <Arg>
      <New class="org.eclipse.jetty.server.SslConnectionFactory">
        <Arg name="next">http/1.1</Arg>
        <Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
      </New>
    </Arg>
  </Call>

  <Call name="addConnectionFactory">
    <Arg>
      <New class="org.eclipse.jetty.server.HttpConnectionFactory">
        <Arg name="config"><Ref refid="sslHttpConfig" /></Arg>
        <Arg name="compliance"><Call class="org.eclipse.jetty.http.HttpCompliance" name="
valueOf"><Arg><Property name="jetty.http.compliance" default="RFC7230"/></Arg></Call></Ar
g>
      </New>
    </Arg>
  </Call>

</Configure>
Run Code Online (Sandbox Code Playgroud)

$ {} JETTY_HOME …

java eclipse ssl jetty docker

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

Kotlin - Maven没有执行测试

我有一个我想测试的Kotlin应用程序.我的tests(.kt)文件在Eclipse中成功执行.(测试本身是一个h2 mockjdbc测试).

现在运行mvn test -X时说:

 releases: [enabled => true, update => never]
]
[DEBUG]   (s) reportFormat = brief
[DEBUG]   (s) reportsDirectory = C:\Users\Ivar\workspace\anotherworkspace\newrestservice\complete\target\surefire-reports
[DEBUG]   (f) rerunFailingTestsCount = 0
[DEBUG]   (f) reuseForks = true
[DEBUG]   (s) runOrder = filesystem
[DEBUG]   (f) shutdown = testset
[DEBUG]   (s) skip = false
[DEBUG]   (f) skipAfterFailureCount = 0
[DEBUG]   (s) skipTests = false
[DEBUG]   (s) suiteXmlFiles = []
[DEBUG]   (s) testClassesDirectory = C:\Users\Ivar\workspace\anotherworkspace\newrestservice\complete\target\test-classes
[DEBUG]   (s) testFailureIgnore = false
[DEBUG] …
Run Code Online (Sandbox Code Playgroud)

unit-testing maven maven-surefire-plugin kotlin

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

汇总 - 冲突的命名空间

我目前正在构建一个Ionic 2-RC3应用程序.但是自从我升级到RC-1后,我遇到了以下错误:(不确定他们是否保持不变,但你明白了).

[15:16:17]  rollup: Conflicting namespaces:
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'TextAst' from
            both
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
            (will be ignored) and
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17]  rollup: Conflicting namespaces:
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'BoundTextAst'
            from both
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
            (will be ignored) and
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17]  rollup: Conflicting namespaces:
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports 'AttrAst' from
            both
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
            (will be ignored) and
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17]  rollup: Conflicting namespaces:
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
            'BoundElementPropertyAst' from both
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
            (will be ignored) and
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17]  rollup: Conflicting namespaces:
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\index.js re-exports
            'BoundEventAst' from both
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js
            (will be ignored) and
            C:\Users\Ivar\documents\ionic2-boilerplate\node_modules\@angular\compiler\src\template_parser\template_ast.js.
[15:16:17]  rollup: Conflicting …
Run Code Online (Sandbox Code Playgroud)

rollup package.json ionic2 angular

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

外部JavaScript库在'{module}/dist /'上返回404

在Angular2中配置外部项目总是遇到一些麻烦.

我想在我的项目中包含ng2-sharebuttons.(似乎没有全局.d.ts文件?)

虽然README.md只是说npm install ng2-sharebuttons --save,我知道还有更多的东西(systemjs.config&typings)

首先,我尝试配置systemjs.config:

map{
     ......
     'ng2-sharebuttons' : 'node_modules/ng2-sharebuttons'
}
Run Code Online (Sandbox Code Playgroud)

这至少固定在404localhost/ng2-sharebuttons,但创造了一个新404localhost/node_modules/ng2-sharebuttons.

所以,我添加了一个主文件,systemjs.config改为

map{
     ......
     'ng2-sharebuttons' : 'node_modules/ng2-sharebuttons/dist/index.js'
}
Run Code Online (Sandbox Code Playgroud)

但现在这导致了404每个孩子ng2-sharebuttons/dist

我尝试过typings install ng2-sharebuttons --save --global,typings install @types/ng2-sharebuttons --save --global无论有没有--global旗帜.

所以在我最后的希望中,我添加了一个参考,看看是否可行.添加

/// <reference path="../../node_modules/ng2-sharebuttons/dist/index.d.ts" />

但这并没有改变任何事情.

我忘记了什么?为什么这么难?(或者我只是努力吗?)

结构和文件ng2-sharebuttons:

在此输入图像描述

最后,Chrome目前正在生成错误消息:

在此输入图像描述

整个 systemjs.config.js

/**
 * System …
Run Code Online (Sandbox Code Playgroud)

node-modules typescript systemjs angular

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

在 OpenApi 3.0 中生成一个属性作为架构定义

使用 swagger 2.0 时,java.util.Currency该类作为单独的定义生成。但是当我们生成 OpenAPI 3.0 时,我们遇到了 swagger-core 将其作为属性生成的问题。


从类生成 OpenAPI 3.0 规范

我们有这个班级:

import java.util.Currency; 

public class Wrapper {
   private Currency currency;
}
Run Code Online (Sandbox Code Playgroud)

从这段代码中,我们使用以下插件配置生成 openapi 规范:

      <plugin>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-maven-plugin</artifactId>
            <version>2.0.9</version>
            <configuration>
                <outputFileName>openapi</outputFileName>
                <outputFormat>YAML</outputFormat>
                <outputPath>....</outputPath>
                <resourcePackages>...</resourcePackages>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>resolve</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
Run Code Online (Sandbox Code Playgroud)

生成时,这将导致此组件定义:

components:
  schemas:
    Wrapper:
      type: "object"
      properties:
        currency:
          type: object
          properties:
            currencyCode:
              type: string
            defaultFractionDigits:
              type: integer
              format: int32
            numericCode:
              type: integer
              format: int32
            displayName:
              type: string
            symbol:
              type: string
Run Code Online (Sandbox Code Playgroud)

从 OpenAPI …

java swagger openapi openapi-generator

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

OpenShift Java - 使用Data dir中的图像

我正在尝试创建一个上传图片按钮,然后在另一个jsp页面上显示图像.

我想通过上传到app-root/data/images文件夹来做到这一点.这适用于以下文件路径:filePath = System.getenv("OPENSHIFT_DATA_DIR") + "images/";

但是如何在我的jsp上显示这个图像呢?我试过用:

<BODY>

    <h1>SNOOP PAGE</h1>
    <a href="profielMijnBedrijf.jsp">Ga weer terug</a>
    <% String filepath =  System.getenv("OPENSHIFT_DATA_DIR") + "images/"; 
     out.println("<img src='"+filepath+"logo21.jpg'/>");

    %>

    <img src="app-root/data/images/logo21.jpg"/>
</BODY>
Run Code Online (Sandbox Code Playgroud)

这两个选项都不起作用.我还读到我需要创建一个符号链接.但是,当我在我的app-root/data或者app-root/data/imagesapp-root命令ln -s返回missing file operand

logo21.jpg确实出现在我的Git bash中

java jsp openshift

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

Angular 2 - ngModel不检查Checkbox

我正在尝试创建一个性别选择视图,包括男性,女性和其他(caitlyn jenner类型的东西).

我现在拥有的是:

在此输入图像描述

在复选框的标签旁边有SVG(复选框将隐藏在生产中,现在在plunkr中可见,用于调试目的)

但当我点击"女性"时,它会将焦点更改为复选框而不是检查它.

Plunkr:http://plnkr.co/edit/Z0Dq2sfJaBrE6Mae2Kg1?p = info

码:

CSS

svg { 
  width: 15px; height: 15px;

  border: 2px solid #a13b4a;
}
label {
  display: inline-block;
  padding-left: 1.5em;
  position: relative;
  cursor: pointer;
  color: black;

}
input[type="checkbox"] {
  opacity: 0;
  width: 15px;
  height: 15px;
}
label svg path {
  transition: stroke-dashoffset .4s linear;
}
input[type="checkbox"]:checked ~ label svg path {
  stroke-dashoffset: 0;
}
input[type="checkbox"]:checked ~ label {
  color: #a13b4a;
}
Run Code Online (Sandbox Code Playgroud)

HTML

 <div>
                            <input type="checkbox" id="male" [(ngModel)]="isMale" name="isMale"/>
                            <label (click)="select('male')" for="male">Male …
Run Code Online (Sandbox Code Playgroud)

checkbox svg angular

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

Swagger根据枚举值生成子类型

我有以下结构

             Notification
                  |
        ------------------------
        |                      |
  SmsNotification         EmailNotification

Run Code Online (Sandbox Code Playgroud)

包含一个包含 或的Notification枚举。现在我有一个类,其中包含一个.notificationTypeSMSEMAILInboxNotification

这是在 swagger yml 中指定的(删除了一些不相关的代码)

definitions:
  Notification:
    type: "object"
    discriminator: "notificationType"
    properties:
      notificationType:
        type: "string"
        description: "Type of notification"
        enum:
          - "EMAIL"
          - "SMS"

  SmsNotification:
    allOf:
      - $ref: "#/definitions/Notification"
      - type: "object"

  EmailNotification
    allOf:
      - $ref: "#/definitions/Notification"
      - type: "object"

  Inbox:
    type: "object"
    properties:
      notification:
        description: "Latest received notification"
        $ref: "#/definitions/Notification"
Run Code Online (Sandbox Code Playgroud)

swagger-codegen v2我使用以下配置生成代码(也尝试过 v3 和 openapi-generator):

<build>
  <plugins>
      <plugin>
          <groupId>io.swagger</groupId>
          <artifactId>swagger-codegen-maven-plugin</artifactId>
          <version>2.3.1</version>
          <executions> …
Run Code Online (Sandbox Code Playgroud)

java swagger swagger-codegen openapi-generator

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