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 { Observable } from 'rxjs'; | |
export const ExampleDecorator: () => MethodDecorator = () => (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => { | |
const original: () => Observable<unknown> = descriptor.value; | |
descriptor.value = function(): Observable<unknown> { | |
try { | |
return original.apply(this, arguments).pipe(); | |
} catch { | |
return original.apply(this, arguments); | |
} |
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 {Pipe, PipeTransform} from '@angular/core'; | |
/** | |
* Pipe do określania słów jakie mają się pojawić po cyfrze np: 1 marka; 2 marki; 12 marek | |
* @example | |
* {{ 20 | howMuch:['marka', 'marki', 'marek']}} | |
*/ | |
@Pipe({name: 'howMuch'}) | |
export class HowMuchPipe implements PipeTransform { | |
/** |
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 {OnInit, Type} from '@angular/core'; | |
/** | |
* Decorator with params for Angular components. | |
* InterfaceName is name of interface that declare required fields, which component should have. | |
* How to use: | |
* ` | |
@DecoratorName(params) | |
@Component({ | |
selector: 'app-example', |