Skip to content

Instantly share code, notes, and snippets.

View wdss93's full-sized avatar
💭
Nice!

Wellington Daniel wdss93

💭
Nice!
View GitHub Profile
@wdss93
wdss93 / user.js
Created May 31, 2019 15:17 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);

Angular 5 - Only Number Input, Only Number Decimal

Allow Only Numbers [0-9]

<input numeric numericType="number" type="text">

Allow Numbers & Decimals [0-9] [also only one dot]

<input numeric numericType="decimal" type="text">
const api = [
{ id: 2, nome: 'Daniel', body: 'Meu nome é Daniel.' },
{ id: 3, nome: 'Silva Santos', body: 'Confira meus sobrenomes.' },
{ id: 4, nome: 'Aderbal', body: 'Dr. Aderbal Sabrá' },
{ id: 5, nome: 'Aderbal', body: 'Dr. Aderbal Sabrá' },
{ id: 6, nome: 'Aderbal', body: 'Dr. Aderbal Sabrá' },
];
const local = [
{ id: 1, nome: 'Wellington', body: 'Sou o Wellington, prazer!' },