Skip to content

Instantly share code, notes, and snippets.

View Abdulrahmanh995's full-sized avatar

Abdulrahman Hashem Abdulrahmanh995

View GitHub Profile
{
"version": "0.2.0",
"configurations": [
{
"command": "npm run start:dev",
"name": "Run npm start",
"request": "launch",
"type": "node-terminal"
},
{
{
"expo": {
// ...
"jsEngine": "hermes",
"ios": {
"jsEngine": "jsc"
}
// ...
}
}
{
"expo": {
// ...
"plugins": ["expo-community-flipper"],
// ....
}
}
...
import { connectToDevTools } from 'react-devtools-core';
if (__DEV__) {
connectToDevTools({
host: "localhost",
port: 8097,
});
}
{
"cli": {
"version": ">= 0.54.1"
},
"build": {
"base": {
"env": {}
},
"development": {
"extends": "base",
npm install -g expo-cli
form: SubmitFormGroup;
ngOnInit() {
this.bindForm();
}
submit(): void {
console.log('form submitted', this.form.value);
}
<div>
<h2>3) Using our custom submission form</h2><br>
<app-submit-form [formGroup]="form" (onSubmit)="submit()">
<label for="name">Name*</label><br>
<input id="name" name="name" type="text" formControlName="name"/>
<app-field-errors [control]="form.get('name')" [label]="'Name'"></app-field-errors>
<br><br>
<label for="email">Email*</label><br>
<input id="email" name="email" formControlName="email"/>
export const messages = {
required: 'Required field',
maxlength: ':field: must be at most :n: characters length.',
minlength: ':field: must be at least :n: characters length.',
max: ':field: must be at most :n:.',
min: ':field: must be at least :n:.',
digits: 'Only digits are allowed',
email: 'Please enter a valid email address',
emailRegistered: 'The email is already registered'
};
@Injectable({ providedIn: 'root' })
export class MessageService {
get(key: string): string {
return messages[key] || key;
}
}