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 ChatRoomComponent implements OnInit { | |
onlineUsersCount: WritableSignal<number> = signal(0) | |
ngOnInit() { | |
// Update count via setter | |
app.events.on('chat.room.connected', () => { | |
this.onlineUsersCount.set(this.onlineUsersCount() + 1); | |
}); | |
// Update count via callback |
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: 'my-cmp', | |
template: ` | |
<span #content>{{ ... }}</span> | |
<span #tooltip>{{ ... }}</span> | |
`, | |
}) | |
export class MyComponent { | |
@ViewChild('content') contentRef: ElementRef; | |
@ViewChild('tooltip') tooltipRef: ElementRef; |
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
@defer (on viewport) { | |
<comment-list> | |
@for(comment of comments) { | |
<comment-item [comment]="comment"></comment-item> | |
} | |
<comment-list /> | |
} @placeholder { | |
<img src="skelton-comments.png"> | |
} |
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
@for (user of users; track user.id) { | |
{{ user.name }} | |
} @empty { | |
Empty list of users | |
} |
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
@switch (accessLevel) { | |
@case ('admin') { <admin-dashboard/> } | |
@case ('moderator') { <moderator-dashboard/> } | |
@default { <user-dashboard/> } | |
} |
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
@if (loggedIn) { | |
The user is logged in | |
} @else { | |
The user is not logged in | |
} |
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
<div *ngIf="loggedIn; else anonymousUser"> | |
The user is logged in | |
</div> | |
<ng-template #anonymousUser> | |
The user is not logged in | |
</ng-template> |
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
fetch('/data.kml') | |
.then(res => res.text()) | |
.then(geojson => { | |
const reader = new KML({ showPointNames: false }); | |
const features = reader.readFeatures(geojson, { featureProjection: 'EPSG:3857' }); | |
const vectorSource = new VectorSource({ features }); | |
map.addLayer(new VectorLayer({ source: vectorSource as any })) | |
}) | |
.catch(() => { | |
alert('hata Oluştu!'); |
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
fetch('/data.json') | |
.then(res => res.json()) | |
.then(geojson => { | |
const reader = new GeoJSON({ featureProjection: 'EPSG:3857' }); | |
const features = reader.readFeatures(geojson); | |
const vectorSource = new VectorSource({ features }); | |
map.addLayer(new VectorLayer({ source: vectorSource })) | |
}) | |
.catch((e) => { | |
alert('hata Oluştu!'); |
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
import Map from 'ol/Map'; | |
import View from 'ol/View'; | |
import TileLayer from 'ol/layer/Tile'; | |
import XYZ from 'ol/source/XYZ'; | |
const map = new Map({ | |
target: 'map', | |
layers: [ | |
new TileLayer({ | |
source: new XYZ({ |
NewerOlder