File tree Expand file tree Collapse file tree 5 files changed +16
-16
lines changed
projects/js-toolkit/packages/liferay-cli/src/new/facet-angular Expand file tree Collapse file tree 5 files changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -53,9 +53,9 @@ const facet: Facet = {
5353
5454 await renderer . render ( 'src/app/app.component.html' , context ) ;
5555 await renderer . render ( 'src/app/app.component.ts' , context ) ;
56- await renderer . render ( 'src/app/dynamic.loader.ts' , context ) ;
56+ await renderer . render ( 'src/app/app. dynamic.loader.ts' , context ) ;
5757 await renderer . render ( 'src/app/app.module.ts' , context ) ;
58- await renderer . render ( 'src/types/LiferayParams .ts' , context ) ;
58+ await renderer . render ( 'src/types/liferay.params .ts' , context ) ;
5959 await renderer . render ( 'src/polyfills.ts' , context ) ;
6060 await renderer . render ( 'src/index.ts' , context ) ;
6161
Original file line number Diff line number Diff line change 11import { Component } from '@angular/core';
22
3- import LiferayParams from '../types/LiferayParams'
3+ import { LiferayParams } from '../types/liferay.params';
44
55declare const Liferay: any;
66
@@ -10,7 +10,7 @@ declare const Liferay: any;
1010 '/o/<%= pkgJson .name %> -<%= pkgJson .version %> /app/app.component.html'
1111})
1212export class AppComponent {
13- params: LiferayParams;
13+ params? : LiferayParams;
1414 labels: any;
1515
1616 constructor() {
@@ -25,6 +25,6 @@ export class AppComponent {
2525 }
2626
2727 get configurationJSON() {
28- return JSON.stringify(this.params.configuration, null, 2);
28+ return JSON.stringify(this.params? .configuration, null, 2);
2929 }
3030}
Original file line number Diff line number Diff line change @@ -6,22 +6,22 @@ import {
66 Type,
77} from '@angular/core';
88
9- import LiferayParams from '../types/LiferayParams'
9+ import { LiferayParams } from '../types/liferay.params';
1010import { AppComponent } from './app.component';
1111
1212/**
1313 * This class loads an Angular component dinamically so that we can attach it to
1414 * the portlet's DOM, which is different for each portlet instance and thus,
1515 * cannot be determined until the page is rendered (during runtime).
1616 */
17- export class DynamicLoader {
17+ export class AppDynamicLoader {
1818 constructor(private injector: Injector) {}
1919
2020 loadComponent<T >(
2121 component: Type<AppComponent >, params: LiferayParams) {
22-
22+
2323 const node = document.getElementById(params.portletElementId);
24-
24+
2525 (<NgZone >this.injector.get(NgZone)).run(() => {
2626 const componentFactory = this.injector
2727 .get(ComponentFactoryResolver)
Original file line number Diff line number Diff line change @@ -3,9 +3,9 @@ import './polyfills';
33import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
44
55import { AppComponent } from './app/app.component';
6+ import { AppDynamicLoader } from './app/app.dynamic.loader';
67import { AppModule } from './app/app.module';
7- import { DynamicLoader } from './app/dynamic.loader';
8- import LiferayParams from './types/LiferayParams'
8+ import { LiferayParams } from './types/liferay.params';
99
1010/**
1111 * This is the actual method that initializes the portlet. It is invoked by the
@@ -21,7 +21,7 @@ export default function(params: LiferayParams) {
2121 // to the portlet's DOM, which is different for each portlet
2222 // instance and, thus, cannot be determined until the page is
2323 // rendered (during runtime).
24- const dynamicLoader = new DynamicLoader (injector);
24+ const dynamicLoader = new AppDynamicLoader (injector);
2525
2626 dynamicLoader.loadComponent(AppComponent, params);
2727 });
Original file line number Diff line number Diff line change 44 * See https://tinyurl.com/js-ext-portlet-entry-point for the most recent
55 * information on the structure of this type.
66 */
7- export default interface LiferayParams {
8- portletElementId: string;
9- contextPath: string;
10- portletNamespace: string;
7+ export interface LiferayParams {
118 configuration: {
129 system: any,
1310 portletInstance: any
1411 }
12+ contextPath: string;
13+ portletElementId: string;
14+ portletNamespace: string;
1515}
1616
You can’t perform that action at this time.
0 commit comments