Skip to content

Commit 76a8f34

Browse files
committed
fix(app): support exportAs for directives
fix #1328
1 parent 56d0651 commit 76a8f34

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

src/app/compiler/angular/deps/directive-dep.factory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export class DirectiveDepFactory {
2121
sourceCode: srcFile.getText(),
2222
selector: this.helper.getComponentSelector(props, srcFile),
2323
providers: this.helper.getComponentProviders(props, srcFile),
24+
exportAs: this.helper.getComponentExportAs(props, srcFile),
2425

2526
inputsClass: IO.inputs,
2627
outputsClass: IO.outputs,
@@ -65,6 +66,7 @@ export interface IDirectiveDep extends IDep {
6566

6667
selector: string;
6768
providers: Array<any>;
69+
exportAs: string;
6870

6971
inputsClass: any;
7072
outputsClass: any;

src/templates/partials/directive.hbs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@
104104
</tr>
105105
{{/if}}
106106

107+
{{#if directive.exportAs}}
108+
<tr>
109+
<td class="col-md-3">{{t "exportAs" }}</td>
110+
<td class="col-md-9"><code>{{directive.exportAs}}</code></td>
111+
</tr>
112+
{{/if}}
113+
107114
</tbody>
108115
</table>
109116
</section>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export const DoNothingDirectiveSchema = {
2-
selector: '[donothing]'
2+
selector: '[donothing]',
3+
exportAs: 'donothing'
34
};

test/src/cli/cli-generation-big-app.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,4 +924,9 @@ describe('CLI simple generation - big app', () => {
924924
const file = read(distFolder + '/modules/FooterModule.html');
925925
expect(file).to.contain('href="../injectables/EmitterService.html">EmitterService');
926926
});
927+
928+
it('should support exportAs for directives', () => {
929+
const file = read(distFolder + '/directives/DoNothingDirective.html');
930+
expect(file).to.contain('<code>donothing</code>');
931+
});
927932
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy