$ npm i prettier prettier-plugin-css-order prettier-plugin-organize-attributes css-declaration-sorter -D
Create .prettierrc
file:
{
"printWidth": 120,
"tabWidth": 2,
import {Pipe, PipeTransform} from '@angular/core'; | |
@Pipe({ | |
name: 'nl2br', | |
standalone: true, | |
}) | |
export class Nl2brPipe implements PipeTransform { | |
transform(text: string): string { | |
return Nl2brPipe.replace(text); | |
} |
$ npm i prettier prettier-plugin-css-order prettier-plugin-organize-attributes css-declaration-sorter -D
Create .prettierrc
file:
{
"printWidth": 120,
"tabWidth": 2,
import { Platform } from '@angular/cdk/platform'; | |
import { Injectable } from '@angular/core'; | |
import { MemoryStorage } from './memory-storage'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
export class LocalStorage implements Storage { | |
private readonly storage: Storage; |
import { existsSync, mkdirSync } from 'fs'; | |
import { resolve } from 'path'; | |
import { config } from '../config'; | |
export async function processTextToSpeech(ssml: string, filename: string) { | |
// Check media dir | |
const dirPath = resolve(config.main.storePath); | |
if (!existsSync(dirPath)) { | |
mkdirSync(dirPath); | |
} |
This allows you to split a template-driven form on components.
Create formProvider
directive to proxy ngModel
injector from parent to child:
import { Directive, SkipSelf, forwardRef } from '@angular/core';
import { ControlContainer, Form } from '@angular/forms';
Official documentation: https://www.typescriptlang.org/docs/handbook/utility-types.html
Make all properties in T
optional.
type t = Partial<{a: string; b: number}>;