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 { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div [align]="alignement" >Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div>
`
})
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div align="{{alignement}}" >Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div>
`
})
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div [align]="alignement" [ngStyle]="{color:couleur}">Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div>
`
})
<div *ngIf="1 > 0"> Afficher la div</div>
<template [ngIf]="1 > 0">
<div> Afficher la div</div>
</template>
<div [ngStyle]="{color:'red'}">Learn Angular</div>
import { Directive } from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor() { }
}
import {Directive, Renderer2, ElementRef} from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor(el: ElementRef, renderer: Renderer2) {
renderer.setStyle(el.nativeElement, 'color', 'red');
}
<div appHighlight>Texte en hightlight</div>
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');
}