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' ;
2
9
3
10
import packageJson from '../../../package.json' ;
4
11
5
12
@Component ( {
6
13
selector : 'app-docs-example' ,
7
14
templateUrl : './docs-example.component.html' ,
8
- styleUrls : [ './docs-example.component.scss' ]
15
+ styleUrls : [ './docs-example.component.scss' ] ,
16
+ changeDetection : ChangeDetectionStrategy . OnPush
9
17
} )
10
- export class DocsExampleComponent {
18
+ export class DocsExampleComponent implements AfterContentInit , AfterViewInit {
11
19
12
- @Input ( ) fragment ?: string ;
20
+ constructor (
21
+ private changeDetectorRef : ChangeDetectorRef
22
+ ) { }
13
23
14
- constructor ( ) { }
24
+ @ Input ( ) fragment ?: string ;
15
25
16
26
private _href = 'https://coreui.io/angular/docs/' ;
17
27
@@ -27,4 +37,12 @@ export class DocsExampleComponent {
27
37
const path : string = version ? `${ version } /${ value } ` : '' ;
28
38
this . _href = `${ docsUrl } ${ path } ` ;
29
39
}
40
+
41
+ ngAfterContentInit ( ) : void {
42
+ this . changeDetectorRef . detectChanges ( ) ;
43
+ }
44
+
45
+ ngAfterViewInit ( ) : void {
46
+ this . changeDetectorRef . markForCheck ( ) ;
47
+ }
30
48
}
You can’t perform that action at this time.
0 commit comments