Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipes can use Angular Life Cycle Hooks; however, I am able to still see ngOnDestroy when compodoc is ran on our pipe
ngOnDestroy
Window Node - 18.14.2 NPM - 9.5.0 compodoc - 1.1.21
package.json
"@angular-devkit/build-angular": "16.1.6", "@angular-devkit/core": "16.1.6", "@angular-devkit/schematics": "16.1.6", "@angular-eslint/eslint-plugin": "16.1.0", "@angular-eslint/eslint-plugin-template": "16.1.0", "@angular-eslint/template-parser": "16.1.0", "@angular/cli": "16.1.6", "@angular/compiler-cli": "16.1.7", "@angular/language-service": "16.1.7", "@compodoc/compodoc": "1.1.19"
Locally
import { OnDestroy, Pipe, PipeTransform } from '@angular/core'; import { SkyAppLocaleInfo, SkyAppLocaleProvider } from '@skyux/i18n'; import { Subject } from 'rxjs'; import { takeUntil } from 'rxjs/operators'; import { SkyDateFormatUtility } from './date-format-utility'; /** * Formats date values according to locale rules. * @example * ```markup * {{ myDate | skyDate }} * {{ myDate | skyDate:'medium' }} * {{ myDate | skyDate:'medium':'en-CA' }} * ``` */ @Pipe({ name: 'skyDate', pure: false, }) export class SkyDatePipe implements OnDestroy, PipeTransform { #defaultFormat = 'short'; #format: string | undefined; #defaultLocale = 'en-US'; #locale: string | undefined; #value: any; #formattedValue: string | undefined; #ngUnsubscribe = new Subject<void>(); constructor(localeProvider: SkyAppLocaleProvider) { localeProvider .getLocaleInfo() .pipe(takeUntil(this.#ngUnsubscribe)) .subscribe((localeInfo: SkyAppLocaleInfo) => { this.#defaultLocale = localeInfo.locale; this.#updateFormattedValue(); }); } public ngOnDestroy(): void { this.#ngUnsubscribe.next(); this.#ngUnsubscribe.complete(); } /** * Transforms a date value using locale and format rules. * @param value Specifies the date value to transform. * @param format Specifies the format to apply to the transform. The format string is * constructed by a series of symbols that represent date-time values. The symbols are * identical to [Angular's `DatePipe`](https://angular.io/api/common/DatePipe#pre-defined-format-options) format options. * @param locale Specifies the locale code to use in the transform. */ public transform(value: any, format?: string, locale?: string): string { this.#value = value; this.#format = format; this.#locale = locale; this.#updateFormattedValue(); return this.#formattedValue ?? ''; } #updateFormattedValue(): void { const locale = this.#locale || this.#defaultLocale; const format = this.#format || this.#defaultFormat; this.#formattedValue = SkyDateFormatUtility.format( locale, this.#value, format ); } }
N/A
We do not want to publicly document the lifecycle hook for this pipe.
Add a pipe with a lifecycle hook and run compodoc with disableLifeCycleHooks
disableLifeCycleHooks
The text was updated successfully, but these errors were encountered:
I'm also seeing this behavior with services.
Sorry, something went wrong.
753b74d
vogloblinsky
No branches or pull requests
Overview of the issue
Pipes can use Angular Life Cycle Hooks; however, I am able to still see
ngOnDestroy
when compodoc is ran on our pipeOperating System, Node.js, npm, compodoc version(s)
Window
Node - 18.14.2
NPM - 9.5.0
compodoc - 1.1.21
Angular configuration, a
package.json
file in the root folderCompodoc installed globally or locally ?
Locally
If possible sourcecode of the file where it breaks
If possible your terminal logs before the error
N/A
Motivation for or Use Case
We do not want to publicly document the lifecycle hook for this pipe.
Reproduce the error
Add a pipe with a lifecycle hook and run compodoc with
disableLifeCycleHooks
Related issues
N/A
Suggest a Fix
The text was updated successfully, but these errors were encountered: