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
# @Author: Nicolas Fazio <webmaster-fazio> | |
# @Date: 20-10-2017 | |
# @Email: contact@nicolasfazio.ch | |
# @Last modified by: webmaster-fazio | |
# @Last modified time: 08-01-2018 | |
# @Url: https://gist.github.com/FazioNico/e22a09144cad8de05d74b7b3bcc6004e | |
# release script v.0.1.0 | |
# git repository config |
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
FROM node:8.9.4 | |
ENV NODE_VERSION 8.9.4 | |
# RUN useradd --user-group --create-home --shell /bin/false app | |
ENV HOME=/home/app | |
WORKDIR $HOME | |
RUN npm config set user 0 | |
RUN npm config set unsafe-perm true | |
RUN npm install -g @angular/cli | |
EXPOSE 4200 49153 |
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 HelloWorld extends HTMLElement { | |
render(): string { | |
return `hello world`; | |
} | |
connectedCallback(): void { | |
this.textContent = this.render(); | |
} | |
} |
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 { Component, OnInit } from '@angular/core'; | |
import { Validators, FormGroup, FormControl, FormArray } from '@angular/forms'; | |
@Component({ | |
selector: 'my-component', | |
template: ` | |
<form [formGroup]="form"> | |
<ul formArrayName="items"> | |
<li [formGroupName]="i" *ngFor="let itemCtrl of form.get('items')?.controls; let i = index" > | |
<input formControlName="title" name="title" type="text" /> <button (click)="removeItem(i)">X</button> |
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 { Component, OnInit } from '@angular/core'; | |
import { Validators, FormGroup, FormControl } from '@angular/forms'; | |
@Component({ | |
selector: 'my-component', | |
template: ` | |
<form [formGroup]="form"> | |
<input formControlName="email" name="email" type="email" /> <br/> | |
<input formControlName="pwd" name="pwd" type="password" /> <br/> | |
<button (click)="submit()">Submit</button> |
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 { Component, OnInit, Input, HostListener, ElementRef } from '@angular/core'; | |
import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'; | |
@Component({ | |
selector: 'app-file-upload', | |
template: ` | |
<div> | |
<span>Choose file</span> | |
<span>{{file ? file.name : 'or drag and drop file here' }}</span> | |
<input class="file-input" type="file"> |
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 { Component, OnInit, Input, HostListener, ElementRef } from '@angular/core'; | |
@Component({ | |
selector: 'app-file-upload', | |
template: ` | |
<div> | |
<span>Choose file</span> | |
<span>{{file ? file.name : 'or drag and drop file here' }}</span> | |
<input class="file-input" type="file"> | |
</div> |
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
const userData = (id = 1) => { | |
const user = fetch(`https://reqres.in/api/users/${id}`) | |
.then(res => res.json()) | |
.then(res => (res && res.data) ? res.data : null); | |
console.log(user); | |
return user; | |
} | |
userData(); |
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
const userData = async (id = 1) => { | |
const user = await fetch(`https://reqres.in/api/users/${id}`) | |
.then(res => res.json()) | |
.then(res => (res && res.data) ? res.data : null); | |
console.log(user); | |
return user; | |
} | |
userData(); |
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
// créer une class qui extend HTMLElement | |
class UserDetailsCard extends HTMLElement { | |
constructor() { | |
super(); | |
// Ajouter un click listener sur notre component | |
this.addEventListener('click', e => { | |
this.toggleDetails(); | |
}); | |
} |
OlderNewer