简体   繁体   English

如何在角度应用程序中集成 nuxeo 聚合物 3 元素?

[英]How to integrate nuxeo polymer 3 elements in angular app?

I've built an Angular 6 app, and I need to include my Nuxeo Polymer 3 Elements (like this one https://github.com/nuxeo/nuxeo-elements/blob/master/core/nuxeo-search.js ).我已经构建了一个 Angular 6 应用程序,我需要包含我的 Nuxeo Polymer 3 Elements(就像这个https://github.com/nuxeo/nuxeo-elements/blob/master/core/nuxeo-search.js )。

How could I have something like:我怎么能有这样的东西:

<app>
   <dom-bind>
      <template>
        <nuxeo-connection
          id="nx"
          url="http://localhost:8080/nuxeo"
          username="Administrator"
          password="Administrator"
        ></nuxeo-connection>
        <nuxeo-search auto searches="{{searches}}"></nuxeo-search>
        <div class="container" class="layout vertical center">
          <template is="dom-repeat" items="{{searches}}">
            <div class="card">
              <div class="prop">
                <label class="propName">id:</label>
                <label class="propValue">[[item.id]]</label>
              </div>
            </div>
          </template>
        </div>
      </template>
    </dom-bind>
</app>

After some times, I can answer my question like explained here .一段时间后,我可以像这里解释的那样回答我的问题。 In brief:简单来说:

  1. Enabling JS in angular in tsconfig.json:在 tsconfig.json 中以角度启用 JS:
{
  compilerOptions: {
    "allowJs": true
  }
}
  1. Enabling custom elements schema in your app module:在您的应用程序模块中启用自定义元素架构:
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
...
@NgModule({   
...
schemas: [CUSTOM_ELEMENTS_SCHEMA],   
...
})
  1. npm install your components npm install你的组件
  2. Use a <nuxeo-connection> in the index.html file before any angular digest在任何角度摘要之前在 index.html 文件中使用<nuxeo-connection>
  3. Finally - in you app.component.html use your web components最后 - 在你的 app.component.html 中使用你的网络组件

 <nuxeo-document-suggestion [router]="router" (selected-item-changed)="select($event.detail.value)" placeholder="Select a document"> </nuxeo-document-suggestion> <div *ngIf="doc"> <nuxeo-page-provider #pp auto provider="advanced_document_content" enrichers="thumbnail" page-size="5" [params]="params" (current-page-changed)="onResults($event.detail.value)"> </nuxeo-page-provider> </div>

Cherry on the cake, Nuxeo web components are available for angular but also React and Vue.js.蛋糕上的樱桃,Nuxeo 网络组件可用于角度,也可用于 React 和 Vue.js。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM