Skip to content

Instantly share code, notes, and snippets.

View realtomaszkula's full-sized avatar

Tomasz Kula realtomaszkula

View GitHub Profile
@Component({
selector: 'app-details-page',
template: '<pre>{{ state$ | async | json }}</pre>'
})
export class DetailsPageComponent implements OnInit {
state$: Observable<object>;
constructor(public activatedRoute: ActivatedRoute) {}
ngOnInit() {
@Component({
selector: 'app-root',
template: `<pre>{{ state$ | async | json }}</pre>`,
})
export class AppComponent implements OnInit {
private state$: Observable<object>;
constructor(public router: Router) { }
ngOnInit() {
@Component({
selector: 'my-app',
template: `
<a routerLink="/details" [state]="{ hello: 'world' }">Go</a>`,
})
export class AppComponent {}
@Component({
template: `<a (click)="navigateWithState()">Go</a>`,
})
export class AppComponent {
constructor(public router: Router) {}
navigateWithState() {
this.router.navigateByUrl('/123', { state: { hello: 'world' } });
}
}
@Component({
selector: 'app-gradient-button',
template: `
<span class="gradient" [ngStyle]="gradientStyle"></span>
<span class="content">
<ng-content></ng-content>
</span>
`,
styles: [
`
@Component({
selector: 'app-gradient-button',
template: `
<span class="gradient"></span>
<span class="content">
<ng-content></ng-content>
</span>
`,
styles: [
`