This file contains 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 TestComponent { | |
constructor(private http: Http) { } | |
ngOnInit() { | |
Observable.timer(1000).subscribe(console.log); | |
this.http.get('http://api.com').subscribe(console.log); | |
} | |
This file contains 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 TestComponent { | |
constructor(private store: Store) { } | |
private componetDestroyed: Subject = new Subject(); | |
todos: Subscription; | |
posts: Subscription; | |
ngOnInit() { | |
this.todosSubscription = this.store.select('todos').takeUntil(this.componetDestroyed).subscribe(console.log); |
This file contains 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
![]; // 'false' | |
!![]; // 'true' | |
[][[]]; // 'undefined' |
This file contains 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
![][1]; // 'a' | |
!![][0]; // 't' | |
[][[]][5]; // 'i' |
This file contains 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
@Component({ | |
selector: 'hello', | |
template: 'Hello!' | |
}) | |
export class HelloComponent {} |
This file contains 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
@NgModule({ | |
declarations: [ HelloComponent ], | |
entryComponents: [HelloComponent], | |
imports: [ BrowserModule ] | |
}) | |
export class AppModule { | |
ngDoBootstrap() { } | |
} |
This file contains 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
platformBrowserDynamic().bootstrapModule(AppModule).then((ngModuleRef: NgModuleRef<AppModule>) => { | |
//... | |
}); |
This file contains 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
platformBrowserDynamic().bootstrapModule(AppModule).then((ngModuleRef: NgModuleRef<AppModule>) => { | |
let componentFactoryResolver = ngModuleRef.componentFactoryResolver; | |
}); |
This file contains 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
platformBrowserDynamic().bootstrapModule(AppModule).then((ngModuleRef: NgModuleRef<AppModule>) => { | |
let componentFactoryResolver = ngModuleRef.componentFactoryResolver; | |
let componentFactory = ngModuleRef.componentFactoryResolver.resolveComponentFactory(HelloComponent); | |
}); |
This file contains 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
platformBrowserDynamic().bootstrapModule(AppModule).then((ngModuleRef: NgModuleRef<AppModule>) => { | |
let componentFactoryResolver = ngModuleRef.componentFactoryResolver; | |
let componentFactory = ngModuleRef.componentFactoryResolver.resolveComponentFactory(HelloComponent); | |
let componentRef = componentFactory.create(ngModuleRef.injector, [], document.querySelector('hello')); | |
}); | |