-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(examples): added dummy pipe and injectable to show their props
- Loading branch information
Showing
6 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...les/angular-cli/src/stories/doc-injectable/__snapshots__/doc-injectable.stories.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots DocInjectable Basic 1`] = ` | ||
<storybook-dynamic-app-root | ||
cfr={[Function CodegenComponentFactoryResolver]} | ||
data={[Function Object]} | ||
target={[Function ViewContainerRef_]} | ||
> | ||
<ng-component> | ||
<div> | ||
<h1> | ||
DocInjectable | ||
</h1> | ||
</div> | ||
</ng-component> | ||
</storybook-dynamic-app-root> | ||
`; |
27 changes: 27 additions & 0 deletions
27
examples/angular-cli/src/stories/doc-injectable/doc-injectable.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpHeaders } from '@angular/common/http'; | ||
|
||
/** | ||
* This is an Angular Injectable | ||
* example that has a Prop Table. | ||
*/ | ||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class DocInjectableService { | ||
/** | ||
* Auth headers to use. | ||
*/ | ||
auth: any; | ||
|
||
constructor() { | ||
this.auth = new HttpHeaders({ 'Content-Type': 'application/json' }); | ||
} | ||
|
||
/** | ||
* Get posts from Backend. | ||
*/ | ||
getPosts() { | ||
return []; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
examples/angular-cli/src/stories/doc-injectable/doc-injectable.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DocInjectableService } from './doc-injectable.service'; | ||
|
||
export default { | ||
title: 'DocInjectable', | ||
component: DocInjectableService, | ||
parameters: { docs: { iframeHeight: 120 } }, | ||
}; | ||
|
||
const modules = { | ||
provider: [DocInjectableService], | ||
}; | ||
|
||
export const Basic = () => ({ | ||
moduleMetadata: modules, | ||
template: '<div><h1>DocInjectable</h1></div>', | ||
}); |
17 changes: 17 additions & 0 deletions
17
examples/angular-cli/src/stories/doc-pipe/__snapshots__/doc-pipe.stories.storyshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots DocPipe Basic 1`] = ` | ||
<storybook-dynamic-app-root | ||
cfr={[Function CodegenComponentFactoryResolver]} | ||
data={[Function Object]} | ||
target={[Function ViewContainerRef_]} | ||
> | ||
<ng-component> | ||
<div> | ||
<h1> | ||
DOCPIPE | ||
</h1> | ||
</div> | ||
</ng-component> | ||
</storybook-dynamic-app-root> | ||
`; |
18 changes: 18 additions & 0 deletions
18
examples/angular-cli/src/stories/doc-pipe/doc-pipe.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
|
||
/** | ||
* This is an Angular Pipe | ||
* example that has a Prop Table. | ||
*/ | ||
@Pipe({ | ||
name: 'docPipe', | ||
}) | ||
export class DocPipe implements PipeTransform { | ||
/** | ||
* Transforms a string into uppercase. | ||
* @param value string | ||
*/ | ||
transform(value: string): string { | ||
return value?.toUpperCase(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
examples/angular-cli/src/stories/doc-pipe/doc-pipe.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DocPipe } from './doc-pipe.pipe'; | ||
|
||
export default { | ||
title: 'DocPipe', | ||
component: DocPipe, | ||
parameters: { docs: { iframeHeight: 120 } }, | ||
}; | ||
|
||
const modules = { | ||
declarations: [DocPipe], | ||
}; | ||
|
||
export const Basic = () => ({ | ||
moduleMetadata: modules, | ||
template: `<div><h1>{{ 'DocPipe' | docPipe }}</h1></div>`, | ||
}); |