diff --git a/packages/angular/src/generators/remote/remote.spec.ts b/packages/angular/src/generators/remote/remote.spec.ts index 73c1abd87f840..e2e7c5420a6aa 100644 --- a/packages/angular/src/generators/remote/remote.spec.ts +++ b/packages/angular/src/generators/remote/remote.spec.ts @@ -150,6 +150,30 @@ describe('MF Remote App Generator', () => { expect(projects.has('remote1-e2e')).toBeFalsy(); }); + it('should generate a correct app component when inline template is used', async () => { + // ARRANGE + const tree = createTreeWithEmptyWorkspace(); + + // ACT + await remote(tree, { + name: 'test', + inlineTemplate: true, + }); + + // ASSERT + expect(tree.read('apps/test/src/app/app.component.ts', 'utf-8')) + .toMatchInlineSnapshot(` + "import { Component } from '@angular/core'; + + @Component({ + selector: 'proj-root', + template: '' + + }) + export class AppComponent {}" + `); + }); + it('should update the index.html to use the remote entry component selector for root when standalone', async () => { // ARRANGE const tree = createTreeWithEmptyWorkspace(); diff --git a/packages/angular/src/generators/remote/remote.ts b/packages/angular/src/generators/remote/remote.ts index e532722a0f9a0..78eb38c275e07 100644 --- a/packages/angular/src/generators/remote/remote.ts +++ b/packages/angular/src/generators/remote/remote.ts @@ -103,8 +103,11 @@ function removeDeadCode(tree: Tree, options: Schema) { ); if (!options.standalone) { const component = - tree.read(pathToAppComponent, 'utf-8').split('templateUrl')[0] + + tree + .read(pathToAppComponent, 'utf-8') + .split(options.inlineTemplate ? 'template' : 'templateUrl')[0] + `template: '' + }) export class AppComponent {}`;