This file contains hidden or 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
| @Directive({ | |
| selector: '[ifFeature]', | |
| }) | |
| export class IfFeatureFlagDirective<IfTemplate, ElseTemplate> { | |
| // assume flags, viewContainerRef, TemplateRef ... | |
| private flag: string; | |
| private elseTemplate: TemplateRef<ElseTemplate>; | |
| @Input('ifFeature') | |
| set ifFeature(f: string) { |
This file contains hidden or 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
| <div *ifFeature="'myNewFeatureFlagOn'; else dontShowMyFeature">My new feature (beta)</div> | |
| <ng-template #dontShowMyFeature>Coming soon...</ng-template> |
This file contains hidden or 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
| <div *ngIf="myNewFeatureFlagOn$ | async">My new feature (beta)</div> |
This file contains hidden or 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
| @Directive({ | |
| selector: '[ifFeature]', | |
| }) | |
| export class IfFeatureFlagDirective<IfTemplate, ElseTemplate> { | |
| // assume flags, viewContainerRef, TemplateRef ... | |
| @Input('ifFeature') | |
| set ifFeature(f: string) { | |
| if(this.flags[f]) { | |
| this.viewContainerRef.createEmbeddedView(this.template); |
This file contains hidden or 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
| This example shows how to apply functions to file names. | |
| Functions from https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/core/src/utils/strings.ts |
This file contains hidden or 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
| class BillPaymentComponent { | |
| bills$: Observable<BillRow[]>; | |
| loading$: Observable<boolean>; | |
| selected: BillRow[] = []; | |
| constructor(private provider: PaymentProvider) {} | |
| ngOnInit() { | |
| this.bills$ = this.provider.bills$; |
This file contains hidden or 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
| class BillPaymentComponent { | |
| bills$: Observable<BillRow[]>; | |
| loading$: Observable<boolean>; | |
| selected: BillRow[] = []; | |
| constructor(page: BillPaymentPage) {} | |
| ngOnInit() { | |
| this.page.onPageEnter(); |
This file contains hidden or 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
| class UserProfilePage { | |
| user$: Observable<User>; | |
| deleteDialog$: Observable<boolen>; | |
| deleteDisclaimer$: Observable<string>; | |
| onPageEnter(userId: string) { | |
| // fetch the user and emit user$ -> User | |
| } |
This file contains hidden or 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
| # these versions are current as of May 18th 2021 | |
| # info from https://www.npmjs.com/package/@angular/cli -> Versions | |
| #Angular 2: looks like this is the last RC version before switching to angular 4 | |
| npx -p @angular/[email protected] ng new angular2app | |
| #Angular 4: the last CLI version before Angular 5 | |
| npx -p @angular/[email protected] ng new angular4app | |
| #Angular 5: the last CLI version before Angular 6 |
This file contains hidden or 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
| cd ./my-package/package | |
| echo '[Action] logging package files' | |
| ls | |
| echo '[Action] adding token to npmrc' | |
| echo '//registry.npmjs.org/:_authToken=$(token)' > .npmrc | |
| npm publish --tag next |