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() |
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-app', | |
template: `<my-product code="7613034626844"></my-product> | |
<my-product code="7613034626844"></my-product> | |
<my-product code="7613034626844"></my-product>`, | |
}) | |
export class AppComponent { | |
} |
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
<my-product code="7613034626844"></my-product> | |
<my-product code="7613034626844"></my-product> | |
<my-product code="7613034626844"></my-product> |
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
resolveProduct(code: string): Observable<any> { | |
if (this.cache[code]) { | |
console.log('Returning cached value!') | |
return this.cache[code]; | |
} | |
console.log('Do the request again') | |
this.cache[code] = this.http.get(this.URL+code+'.json').pipe( | |
shareReplay(1), | |
catchError(err => { |
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 { faBalanceScale } from '@fortawesome/pro-solid-svg-icons'; | |
import { faBan } from '@fortawesome/pro-regular-svg-icons'; | |
export class IconsModule { | |
constructor(library: FaIconLibrary) { | |
library.addIcons( | |
faBalanceScale, | |
faBan, | |
//... and the rest of icons) | |
} |
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
/** | |
* @param {number} a | |
* @param {number} b | |
* @return {number} | |
*/ | |
function sum(a, b) { | |
return a+b; | |
} |
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
/** @type {string} */ | |
var a; | |
/** @type {number} */ | |
const Pi; | |
/** @type {boolean} */ | |
let isChecked; |
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: "app-totoro", | |
template: ` | |
<pre>{{ totoroDetails | json }}</pre> | |
` | |
}) | |
export class TotoroComponent implements OnInit, OnDestroy { | |
totoroDetails: string; | |
subscription: Subscription<any>; | |
constructor(private http: HttpClient) {} |
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: 'app-totoro', | |
template: `<pre>{{totoroDetails$ | async | json}}</pre>`, | |
}) | |
export class TotoroComponent implements OnInit { | |
totoroDetails$: string; | |
constructor(private http: HttpClient) { | |
} | |
ngOnInit() { |
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
<div *ngIf="isCompetenceCatalogEditor$ | async"> some content</div> | |
<div *ngIf="isCompetenceCatalogEditor$ | async"> some more content</div> | |
<div *ngIf="isCompetenceCatalogEditor$ | async"> some more more content</div> |