File tree Expand file tree Collapse file tree 1 file changed +23
-5
lines changed
src/components/docs-example Expand file tree Collapse file tree 1 file changed +23
-5
lines changed Original file line number Diff line number Diff line change 1- import { Component , Input } from '@angular/core' ;
1+ import {
2+ AfterContentInit ,
3+ AfterViewInit ,
4+ ChangeDetectionStrategy ,
5+ ChangeDetectorRef ,
6+ Component ,
7+ Input
8+ } from '@angular/core' ;
29
310import packageJson from '../../../package.json' ;
411
512@Component ( {
613 selector : 'app-docs-example' ,
714 templateUrl : './docs-example.component.html' ,
8- styleUrls : [ './docs-example.component.scss' ]
15+ styleUrls : [ './docs-example.component.scss' ] ,
16+ changeDetection : ChangeDetectionStrategy . OnPush
917} )
10- export class DocsExampleComponent {
18+ export class DocsExampleComponent implements AfterContentInit , AfterViewInit {
1119
12- @Input ( ) fragment ?: string ;
20+ constructor (
21+ private changeDetectorRef : ChangeDetectorRef
22+ ) { }
1323
14- constructor ( ) { }
24+ @ Input ( ) fragment ?: string ;
1525
1626 private _href = 'https://coreui.io/angular/docs/' ;
1727
@@ -27,4 +37,12 @@ export class DocsExampleComponent {
2737 const path : string = version ? `${ version } /${ value } ` : '' ;
2838 this . _href = `${ docsUrl } ${ path } ` ;
2939 }
40+
41+ ngAfterContentInit ( ) : void {
42+ this . changeDetectorRef . detectChanges ( ) ;
43+ }
44+
45+ ngAfterViewInit ( ) : void {
46+ this . changeDetectorRef . markForCheck ( ) ;
47+ }
3048}
You can’t perform that action at this time.
0 commit comments