@acoustic-content-sdk/ng-web-component

Module to attach inline-edit functionality to an WCH based Angular application.

Usage no npm install needed!

<script type="module">
  import acousticContentSdkNgWebComponent from 'https://cdn.skypack.dev/@acoustic-content-sdk/ng-web-component';
</script>

README

npm

Implementation of an Angular Component that can dynamically inject web components for layouts.

This allows you to add application components without having to recompile the application. Components can be registered with Acoustic Content using regular layout definitions and wchtools.

Table of Contents

Adding a WebComponents based Layout Component

In order to include an application component using web components you need to provide the following artifacts:

  • a content type
  • a layout
  • a layout mapping
  • a web component

Content Type, Layout and Layout Mapping

Follow the instructions for adding handlebars based layouts to Acoustic content. The result is a content type, a layout and a layout mapping.

Web Component

Create a JS file with your web component in CommonJS module format. The simplest form would be:

class MyComponent extends HTMLElement {
  constructor() {
    super();
  }

  connectedCallback() {
    this.innerHTML = `<div>Works!</div>`;
  }
}

module.exports = { MyComponent };

Make this file available on a web server, e.g. by pushing it to your tenant. Say the file is then available via https://my-server/my-component.js

Note: for a real-world application I recommend to use webpack to bundle your component.

Reference you Component from the Layout

In the first step you have created a layout descriptor file. Add the tags member and reference your component from a tag using the syntax bundle:{$URL}#{$COMPONENT}:

{
  "tags": ["bundle:https://my-server/my-component.js#MyComponent"]
}

This syntax allows you to package multiple layout components in one file.

Push your changed layout to your tenant.

Note: The URL may be absolute or relative. If absolute it can point to any server location. If relative it is resolved relative to the resource base URL for the tenant. This allows you to simply upload your scripts as unmanaged assets to your tenant.

Home > @acoustic-content-sdk/ng-web-component

ng-web-component package

Implementation of an Angular component that can dynamically inject web components for layouts

Classes

Class Description
AcNgWebComponentModule

Variables

Variable Description
VERSION Version and build number of the package

Home > @acoustic-content-sdk/ng-web-component > AcNgWebComponentModule

AcNgWebComponentModule class

Signature:

export declare class AcNgWebComponentModule 

Properties

Property Modifiers Type Description
VERSION WchSdkVersion Exposes the version information of this module

Home > @acoustic-content-sdk/ng-web-component > VERSION

VERSION variable

Version and build number of the package

Signature:

VERSION: {
    version: {
        major: string;
        minor: string;
        patch: string;
        branch: string;
    };
    build: Date;
}

Home > @acoustic-content-sdk/ng-web-component > AcNgWebComponentModule > VERSION

AcNgWebComponentModule.VERSION property

Exposes the version information of this module

Signature:

VERSION: WchSdkVersion;