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
| // Example showing property binding for ngComponentOutle | |
| @Component({ | |
| template: `<ng-container | |
| *ngComponentOutlet="component; inputs: context" | |
| ></ng-container>`, | |
| standalone: true, | |
| imports: [NgComponentOutlet], | |
| }) | |
| export class AppComponent { |
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
| import { Component, effect, signal } from '@angular/core'; | |
| import { TestBed } from '@angular/core/testing'; | |
| it('does not execute effects', () => { | |
| TestBed.runInInjectionContext(() => { | |
| let sum = 0; | |
| const numbers = signal([1, 2, 3]); | |
| effect(() => (sum = numbers().reduce((n1, n2) => n1 + n2))); | |
| expect(sum).toBe(6); // 0 |
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
| import { isEqual } from 'lodash'; | |
| import { | |
| createFeatureSelector, | |
| createSelector, | |
| createSelectorFactory, | |
| defaultMemoize, | |
| } from '@ngrx/store'; | |
| import * as fromFlightBooking from './flight-booking.reducer'; | |
| export const selectFlightBookingState = createFeatureSelector< |
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
| import { test, expect } from '@playwright/test'; | |
| test.describe('initial test', () => { | |
| test('holidays', async ({ page }) => { | |
| await page.goto('https://genuine-narwhal-f0f8ad.netlify.app/'); | |
| await page.click('[data-testid=btn-holidays]'); | |
| await expect(page.locator('mat-drawer-content')).toContainText( | |
| 'Choose among our Holidays' | |
| ); |
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
| import { Component } from '@angular/core'; | |
| import { fakeAsync, flush, TestBed } from '@angular/core/testing'; | |
| import { | |
| SchedulerEvent, | |
| SchedulerModule, | |
| } from '@progress/kendo-angular-scheduler'; | |
| const baseData: any[] = [ | |
| { | |
| TaskID: 4, |
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
| const removed = createAction( | |
| '[CUSTOMER] Removed', | |
| props<{ customers: Customer[] }>() | |
| ); | |
| // further actions (removed here for simplicity reasons) | |
| export const CustomerActions = { | |
| get, |
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
| export * from './lib/customer-data.module'; | |
| export { PublicCustomerActions as CustomerActions } from './lib/customer.actions'; | |
| export * from './lib/customer.selectors'; |
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
| @Component({ | |
| selector: 'eternal-edit-customer', | |
| template: ` <eternal-customer | |
| *ngIf="customer$ | async as customer" | |
| [customer]="customer" | |
| (save)="this.submit($event)" | |
| (remove)="this.remove($event)" | |
| ></eternal-customer>`, | |
| }) | |
| export class EditCustomerComponent implements OnInit { |
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
| export class CustomerComponent { | |
| formGroup = new FormGroup({}); | |
| @Input() customer: Customer | undefined; | |
| @Output() save = new EventEmitter<Customer>(); | |
| @Output() remove = new EventEmitter<Customer>(); | |
| fields: FormlyFieldConfig[] = [ | |
| // form configuration | |
| ]; |
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
| @Injectable({ | |
| providedIn: 'root', | |
| }) | |
| export class DataGuard implements CanActivate { | |
| constructor(private store: Store<CustomerAppState>) {} | |
| canActivate(): Observable<boolean> { | |
| this.store.dispatch(CustomerActions.get()); | |
| return this.store | |
| .select(fromCustomer.isLoaded) |
NewerOlder