Skip to content

Instantly share code, notes, and snippets.

View djabif's full-sized avatar

Dayana Jabif djabif

View GitHub Profile
{
"controls": [
{
"name": "address1",
"label": "Address line 1:",
"value": "",
"type": "text"
},
{
"name": "address2",
<ng-container *ngFor="let control of jsonFormData?.controls">
<label class="block mt-6" for="{{ control.name }}">{{
control.label
}}</label>
<input
*ngIf="
[
'text',
'password',
'email',
{
"controls": [
{
"name": "firstName",
"label": "First name:",
"value": "",
"type": "text"
},
{
"name": "lastName",
@djabif
djabif / home.service.ts
Last active March 20, 2023 13:46
Angular Components Challenge - service with dummy data
import { Injectable } from '@angular/core';
import { CardItem } from 'src/app/shared/card-helpers/card-item.model';
import { PostCardComponent } from 'src/app/shared/card-templates/post-card/post-card.component';
import { ProductCardComponent } from 'src/app/shared/card-templates/product-card/product-card.component';
import { QuoteCardComponent } from 'src/app/shared/card-templates/quote-card/quote-card.component';
@Injectable()
export class HomeService {
public getItems(): CardItem[] {
return [
@djabif
djabif / .gitignore
Last active January 12, 2023 13:04
gitignore
# Specifies intentionally untracked files to ignore when using Git
# http://git-scm.com/docs/gitignore
*~
*.sw[mnpcod]
*.log
*.tmp
*.tmp.*
log.txt
*.sublime-project
@djabif
djabif / click-to-tweet.component.html
Last active February 8, 2021 18:06
Click to tweet Angular Component
<a href="{{tweetUrl}}" target="_blank">
<span class="cta">{{cta}}</span>
<i class="fab fa-twitter twitter-icon"></i>
</a>
@djabif
djabif / seo.directive.ts
Last active September 22, 2020 17:22
Angular directive to set dynamic Meta Tags for SEO
import { Directive, OnDestroy, OnInit, Inject } from '@angular/core';
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
import { Meta, Title } from '@angular/platform-browser';
import { filter, map, mergeMap } from 'rxjs/operators';
import { DOCUMENT, PlatformLocation } from '@angular/common';
@Directive({
selector: '[appSeo]'
})
@djabif
djabif / matching-passwords.validator.ts
Last active May 19, 2023 14:10
Angular Validator for Matching Passwords
import { FormControl, FormGroup } from '@angular/forms';
export class PasswordValidator {
// If our validation fails, we return an object with a key for the error name and a value of true.
// Otherwise, if the validation passes, we simply return null because there is no error.
static areNotEqual(formGroup: FormGroup) {
let firstControlValue: any;
let valid = true;
// Custom variables
// Note: These ones were added by us and have nothing to do with Ionic CSS Custom Properties
:host {
--page-margin: var(--app-fair-margin);
--page-background: var(--app-background-alt-shade);
--page-headers-shadow-color: rgba(var(--ion-color-darkest-rgb), 0.4);
}
// Note: All the CSS variables defined below are overrides of Ionic elements CSS Custom Properties
<ion-app dir="{{textDir}}">
<ion-split-pane>
<ion-menu class="app-sidemenu">
<ion-header>
<ion-toolbar>
<ion-row class="user-details-wrapper">
<ion-col size="4">
<app-aspect-ratio [ratio]="{w: 1, h: 1}">
<app-image-shell class="user-avatar add-spinner" [src]="'https://pbs.twimg.com/profile_images/722153095761903616/WjIKQ7Wm_400x400.jpg'"></app-image-shell>
</app-aspect-ratio>