小编atu*_*hra的帖子

将列表添加到Json ObjectNode

ObjectNode row = Json.newObject();
row.put("0", a);
row.put("1", x);
row.put("2", y);
Run Code Online (Sandbox Code Playgroud)

现在我有清单

List<String> list = new ArrayList<String>();
Run Code Online (Sandbox Code Playgroud)

如何将其添加到行中?

java json

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

微小的Mce双向绑定与Angular 2/4

这是我的 tinymce.component.ts

import {
  Component,
  OnDestroy,
  AfterViewInit,
  EventEmitter,
  Input,
  Output
} from '@angular/core';

@Component({
  selector: 'simple-tiny',
  template: `<textarea id="{{elementId}}"></textarea>`
})
export class SimpleTinyComponent implements AfterViewInit, OnDestroy {
  @Input() elementId: String;
  @Output() onEditorKeyup = new EventEmitter<any>();

  editor;

  ngAfterViewInit() {
    tinymce.init({
      selector: '#' + this.elementId,
      plugins: ['link', 'paste', 'table'],
      skin_url: 'assets/skins/lightgray',
      setup: editor => {
        this.editor = editor;
        editor.on('keyup', () => {
          const content = editor.getContent();
          this.onEditorKeyup.emit(content);
        });
      },
    });
  }

  ngOnDestroy() {
    tinymce.remove(this.editor);
  }
}
Run Code Online (Sandbox Code Playgroud)

现在我正在使用它我的html现在我可以得到文本通过keyupHandlerFunction但我想要2路绑定ngModel

<simple-tiny
      [elementId]="'my-editor-id'" …
Run Code Online (Sandbox Code Playgroud)

tinymce tinymce-4 tinymce-3 angular

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

Http获取响应更新HTML,但在控制台中给出了未定义的错误

当我使用HttpClient使用响应Obj 更新html时,它会更新值,但会出现多个错误。

文件名-auth-service.ts。

    import { any } from 'codelyzer/util/function';
    import { Injectable } from '@angular/core';
    import { HttpClient } from '@angular/common/http';

    @Injectable()
    export class AuthService {

      constructor(private httpClient: HttpClient) { }
      get() {
        return this.httpClient.get<any>('/capi/v2/users/me', {
          observe: 'body',
          responseType: 'json'
        });
      }
    };
Run Code Online (Sandbox Code Playgroud)

文件名-dashboard.component.ts

    import { AuthService } from './../../services/api/auth-service';

    import { Component, Injectable, OnInit } from '@angular/core';

    @Component({
        selector: 'app-dashboard',
        templateUrl: './dashboard.component.html'
    })

    @Injectable()
    export class DashBoardComponent implements OnInit {
        user;
        constructor(private authService: AuthService) {}; …
Run Code Online (Sandbox Code Playgroud)

angular2-template angular2-services angular angular4-httpclient

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