Skip to content

Instantly share code, notes, and snippets.

View wKoza's full-sized avatar
🌏
A new opportunity ? hmmm why not

William Koza wKoza

🌏
A new opportunity ? hmmm why not
  • Self-employment
  • France
View GitHub Profile
import {Directive, Renderer2, ElementRef, HostListener, Input} from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
@Input('appHighlight') highlightColor: string;
private _defaultColor = 'red';
import {Directive, Renderer2, ElementRef, HostListener} from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor(el: ElementRef, renderer: Renderer2) {
renderer.setStyle(el.nativeElement, 'color', 'red');
}
Observable<Article> article$ = this.http.get<Article>('api.learn-angular.fr/article', {responseType: 'blob'});
Observable<Article[]> articles$ = this.http.get<Article[]>('api.learn-angular.fr/articles');
@wKoza
wKoza / httpclient.ts
Last active July 17, 2017 13:45
httpclient.ts
Observable<Article[]> articles$ = this.http.get('api.learn-angular.fr/articles')
.map((res:Response) => res.json() as Article[]);
<ma-taille
[taille]="maTaille"
(tailleChange)="maTaille=$event"></ma-taille>
import {Component} from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div [align]="alignement" [ngStyle]="{color:couleur}">Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div>
<app-comp1 [monAdresse]="address"></app-comp1>
<button (click)="modifierPersonne()">Modifier personne</button>
`
import {Directive, Renderer2, ElementRef} from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor(el: ElementRef, renderer: Renderer2) {
renderer.setStyle(el.nativeElement, 'color', 'red');
}
import { Component, Injectable } from '@angular/core';
import { ActivatedRoute } from "@angular/router";
@Component({
selector: 'app-threads',
templateUrl: './threads.component.html',
styleUrls: ['./threads.component.css']
})
export class ThreadsComponent {
import {Component, Input, EventEmitter, Output} from '@angular/core';
@Component({
selector: 'person',
template: `
<div *ngIf="!disable">
<h1>{{person.name}} {{person.lastname}}</h1>
<button (click)="choose()">Choisir</button>
<hr>
</div>`