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
export class ArticleComponent { | |
article$: Observable<Article>; | |
constructor( | |
http: HttpClient, | |
route: ActivatedRoute, | |
@Inject(PLATFORM_ID) platformId: string, | |
meta: Meta, | |
transferState: TransferState, | |
) { |
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
// This will be used on the client-side | |
@Injectable({ providedIn: 'root' }) | |
export class ArticleService { | |
constructor(private transferState: TransferState) {} | |
getArticle(id: string): Observable<Article> { | |
const key = makeStateKey<Article>(`article:${id}`); | |
const article = this.transferState.get(key, null!); | |
return of(article); | |
} |
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
if (isPlatformServer(platformId)) { | |
// Do some server-side stuff... | |
} |
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
Vue.component('lazy', () => import('./lazy.component')); |
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 { | |
Component, | |
ChangeDetectionStrategy, | |
ViewChild, | |
ViewContainerRef, | |
ComponentFactoryResolver, | |
Injector | |
} from '@angular/core'; | |
@Component({ |
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 { | |
Component, | |
ɵrenderComponent as renderComponent, | |
Injector, | |
ɵLifecycleHooksFeature as LifecycleHooksFeature, | |
ɵmarkDirty as markDirty | |
} from '@angular/core'; | |
@Component({ | |
selector: 'app-root', |
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 { | |
Component, | |
ɵrenderComponent as renderComponent, | |
Injector, | |
ɵLifecycleHooksFeature as LifecycleHooksFeature | |
} from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
template: ` |
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 { Component, ɵrenderComponent as renderComponent, Injector } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
template: ` | |
<app-button></app-button> | |
` | |
}) | |
export class AppComponent { | |
constructor(injector: Injector) { |