0.8.10 • Published 3 years ago

@robingoupil/ng-srm-wrapper v0.8.10

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Table of contents

Quick start

Install @robingoupil/ng-srm-wrapper:

  • with npm: npm install -S @robingoupil/ng-srm-wrapper
  • with yarn: yarn add @robingoupil/ng-srm-wrapper

Add the module to NgModule imports

AppModule

import { NgSRMWrapperModule } from '@robingoupil/ng-srm-wrapper';

@NgModule({
  ...
  modules: [ NgSRMWrapperModule, ... ],
  ...
})

Create a loader component for your SRM.
We will assume that:

  • the asset-manifest.json file url is stored in environment.assetManifestUrl
  • once loaded, the SRM render() function is exposed in window.myOrg.myModule
  • the module will be served with the relative path /my-module

my-module-loader.component.ts

import { Component } from '@angular/core';

import { environment } from 'projects/my-project/src/environments/environment';

@Component({
  selector: 'app-my-modue-loader',
  templateUrl: './my-modue-loader.component.html',
})
export class MyModuleLoaderComponent {
  const assetManifestUrl = environment.assetManifestUrl;
}

my-module-loader.component.html

<ng-srm-wrapper assetManifestUrl="{{assetManifestUrl}}" exportPath="myOrg.myModule" basename="/my-module"></ng-srm-wrapper>

Expose the loader in the app router

AppRoutingModule

const routes: Routes = [
  {
    path: 'my-module',
    children: [
        {
            path: '**',
            component: MyModuleLoaderComponent,
        },
    ],
  }
];

API Reference

NgSRMWrapper

Selectorng-srm-wrapper

Inputs

assetManifestUrlType: string URL to the asset-manifest.json.
exportPathType: string Path to the exported render() function once the module has been loaded.
basenameType: string Default value: / Relative path the module is being served from.
languageType: string Default value: en Language used for i18n.
argumentsType: object Default value: {} Extra arguments to pass to the render() function.
eventHandlersType: object Default value: {} Custom events that can be called by the SRM.

Outputs

loadedType: EventEmitter<HTMLElement> Emits an event when the module has been loaded.
renderedType: EventEmitter<any> Emits an event when the module has been rendered.
0.8.10

3 years ago

0.8.9

3 years ago

0.8.8

3 years ago

0.8.7

3 years ago

0.8.6

3 years ago

0.8.5

3 years ago

0.8.4

3 years ago

0.8.3

3 years ago

0.8.2

3 years ago

0.8.1

3 years ago

0.7.9

3 years ago

0.7.7

3 years ago

0.7.6

3 years ago

0.7.5

3 years ago