Skip to content

Instantly share code, notes, and snippets.

Avatar
🌏
A new opportunity ? hmmm why not

William Koza wKoza

🌏
A new opportunity ? hmmm why not
View GitHub Profile
View app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div align="{{alignement}}" >Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div>
`
})
View app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div [align]="alignement" [ngStyle]="{color:couleur}">Personne : {{person}} | Age : {{age}} | Adresse : {{address.street}}</div>
`
})
View directive.html
<div *ngIf="1 > 0"> Afficher la div</div>
View directive.html
<template [ngIf]="1 > 0">
<div> Afficher la div</div>
</template>
View attribute-directive.html
<div [ngStyle]="{color:'red'}">Learn Angular</div>
View highlight.directive.ts
import { Directive } from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor() { }
}
View exemple.html
<div appHighlight>Texte en hightlight</div>
View directive.html
<div [appHighlight]="'yellow'">Texte en highlight</div>
View app.component.ts
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>
`
})
export class AppComponent {
View comp1.component.css
import {Component, Input} from '@angular/core';
@Component({
selector: 'app-comp1',
template: `
{{monAdresse.street}}
`
})
export class Comp1Component {