Skip to content

Instantly share code, notes, and snippets.

Avatar

Cyrille Tuzi cyrilletuzi

View GitHub Profile
View architecture.txt
app/
|- app.module.ts
|- app-routing.module.ts
|- core/
|- auth/
|- auth.module.ts (optional since Angular 6)
|- auth.service.ts
|- index.ts
|- othermoduleofglobalservice/
|- ui/
View spec.ts
describe('Account', () => {
it('should register successfully', () => {
const email = `test_${Date.now()}@example.com`;
const password = 'test';
cy.visit('/account/register');
cy.get('input[type="email"]').type(email);
View app.e2e-spec.ts
import { browser, $, ExpectedConditions } from 'protractor';
describe('Account', () => {
it('should register successfully', async () => {
const email = `test_${Date.now()}@example.com`;
const password = 'test';
await browser.get('/account/register');
View .eslintrc.json
{
"root": true,
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:cypress/recommended"
]
}
View .eslintrc.json
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"overrides": [
{
"files": [
"*.ts"
],
View settings.json
{
"angular.experimental-ivy": true
}
View tsconfig.json
{
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictTemplates": true,
"strictInputAccessModifiers": true
}
}
View universal.interceptor.ts
import { Injectable, Inject, Optional } from '@angular/core';
import { HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';
@Injectable()
export class UniversalInterceptor implements HttpInterceptor {
constructor(@Optional() @Inject('serverUrl') protected serverUrl: string) {}
intercept(req: HttpRequest<any>, next: HttpHandler) {
View hello.component.html
<div *ngFor="let movie of movies">
<h2>{{movie.title}}</h2>
<p>{{movie.description}}</p>
</div>
View methods.js
myEmail.strpos('@');
myEmail.replace('@', ' at ');
myEmail.substring(0, 5);
myEmail.length;
Number.parseInt('5', 10);