ποΈ
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, signal } from '@angular/core'; | |
import { ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { IfHasPermissionDirective } from './if-has-permission.directive'; | |
import { Permission, PermissionsService } from '../permissions.service'; | |
const $allowedPermissions = signal<Permission[]>([]); | |
class PermissionsServiceMock { | |
hasPermission(permission: Permission) { | |
return $allowedPermissions().includes(permission); |
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 { inject, TemplateRef, ViewContainerRef } from "@angular/core"; | |
export abstract class StructuralConditionalDirective { | |
protected readonly templateRef = inject(TemplateRef<any>); | |
protected readonly viewContainer = inject(ViewContainerRef); | |
protected elseTemplateRef: TemplateRef<any> | undefined = undefined; | |
protected hasView: boolean = false; | |
protected hasElseView: boolean = false; | |
protected condition: boolean = false; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 { assertInInjectionContext, DestroyRef, inject, Injector, isDevMode, isSignal, type Signal } from '@angular/core'; | |
import { takeUntilDestroyed, toObservable } from '@angular/core/rxjs-interop'; | |
import { isObservable, Observable, of, retry, type RetryConfig, Subject, Subscription } from 'rxjs'; | |
export type CreateEffectOptions = { | |
injector?: Injector, | |
/** | |
* @param retryOnError | |
* Set to 'false' to disable retrying on error. | |
* Otherwise, generated effect will use `retry()`. |
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
platformBrowserDynamic().bootstrapModule(AppModule, { | |
ngZoneEventCoalescing: true, | |
ngZoneRunCoalescing: true, | |
}).catch((err) => console.error(err)); |
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
$dark-primary-text: rgba(0, 0, 0, 0.87); | |
$light-primary-text: rgb(255, 255, 255); | |
$viva-magenta: ( | |
50 : #f7e5e9, | |
100 : #ebbec8, | |
200 : #dd93a4, | |
300 : #cf6780, | |
400 : #c54764, | |
500 : #bb2649, |
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 SomeComponent { | |
@Input() set field(field: someType) { | |
this.store.patchState({field}); | |
} | |
} |
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
libs/feature/src: | |
ββ lib | |
ββ example | |
β ββ example.component.html | |
β ββ [example.component.scss] | |
β ββ example.component.spec.ts | |
β ββ example.component.ts | |
β ββ [example.store.ts] | |
β ββ [README.md] | |
ββ [README.md] |
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
interface UsersListState { | |
users: User[]; | |
columns: string[]; | |
} | |
class UsersListStore extends ComponentStore<UsersListState> { | |
// ... | |
getUsers() { | |
return this.select(state => state.users).pipe( | |
combineLatestWith(this.select(state => state.columns)), | |
map(([users, columns]) => { |
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 UploaderConfig { | |
public readonly url: string; | |
} | |
// Service, where you need UploaderConfig | |
class ApiService { | |
constructor(@Inject('UPLOADER_CONFIG') config: UploaderConfig){ | |
} | |
} | |
// Module or component where you can configure dependencies: |