Last active
October 8, 2019 18:00
-
-
Save ganqqwerty/2358f76542bd4ba7d3c7f0735f524e39 to your computer and use it in GitHub Desktop.
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
@Component({ | |
selector: 'my-product', | |
template: ` | |
<pre *ngIf="code"> | |
{{(result$|async)|json}} | |
</pre> | |
`, | |
}) | |
export class ProductComponent { | |
@Input() | |
code: string; | |
result$: Observable<any>; | |
constructor(private productService: ProductService) { | |
this.result$ = productService.resolveProduct(this.code); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment