Skip to content

Commit

Permalink
fix(app): support exportAs for directives
Browse files Browse the repository at this point in the history
fix #1328
  • Loading branch information
vogloblinsky committed May 16, 2023
1 parent 56d0651 commit 76a8f34
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/app/compiler/angular/deps/directive-dep.factory.ts
Expand Up @@ -21,6 +21,7 @@ export class DirectiveDepFactory {
sourceCode: srcFile.getText(),
selector: this.helper.getComponentSelector(props, srcFile),
providers: this.helper.getComponentProviders(props, srcFile),
exportAs: this.helper.getComponentExportAs(props, srcFile),

inputsClass: IO.inputs,
outputsClass: IO.outputs,
Expand Down Expand Up @@ -65,6 +66,7 @@ export interface IDirectiveDep extends IDep {

selector: string;
providers: Array<any>;
exportAs: string;

inputsClass: any;
outputsClass: any;
Expand Down
7 changes: 7 additions & 0 deletions src/templates/partials/directive.hbs
Expand Up @@ -104,6 +104,13 @@
</tr>
{{/if}}

{{#if directive.exportAs}}
<tr>
<td class="col-md-3">{{t "exportAs" }}</td>
<td class="col-md-9"><code>{{directive.exportAs}}</code></td>
</tr>
{{/if}}

</tbody>
</table>
</section>
Expand Down
@@ -1,3 +1,4 @@
export const DoNothingDirectiveSchema = {
selector: '[donothing]'
selector: '[donothing]',
exportAs: 'donothing'
};
5 changes: 5 additions & 0 deletions test/src/cli/cli-generation-big-app.spec.ts
Expand Up @@ -924,4 +924,9 @@ describe('CLI simple generation - big app', () => {
const file = read(distFolder + '/modules/FooterModule.html');
expect(file).to.contain('href="../injectables/EmitterService.html">EmitterService');
});

it('should support exportAs for directives', () => {
const file = read(distFolder + '/directives/DoNothingDirective.html');
expect(file).to.contain('<code>donothing</code>');
});
});

0 comments on commit 76a8f34

Please sign in to comment.