Skip to content

Instantly share code, notes, and snippets.

@KarolinaCzo
KarolinaCzo / gist:d9e3a1d491bae065df94a6271ebe777b
Created July 18, 2018 12:17
Resolving 'AppComponent › should create the app'
// After runing tests this error occur:
// Template parse errors:
// 'app-main-page' is not a known element:
// 1. If 'app-main-page' is an Angular component, then verify that it is part of this module.
// 2. If 'app-main-page' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (
// Solution below
// Code from: 'app.component.spec.ts'
import { TestBed, async } from '@angular/core/testing';
@KarolinaCzo
KarolinaCzo / gist:72a356c19eb511ad8a7b4594bdfa159b
Last active October 16, 2023 18:13
Add @fortawesome/fontawesome-free to an Angular project
How to add Font Awesome @fortawesome/fontawesome-free to an Angular project?
1) Go to the project directory
2) Install Font Awesome as said on their website:
https://fontawesome.com/how-to-use/on-the-web/setup/getting-started?using=web-fonts-with-css
through npm: npm install --save @fortawesome/fontawesome-free
Use '--save' not '--save-dev'
3) Add Font Awesome to 'styles' in 'anguler.json':
@KarolinaCzo
KarolinaCzo / gist:49446ceb833a95a7d3b3f12f9c8fb3f8
Last active July 25, 2018 08:20
How to make a 'window:scroll' Event Listener in Angular6
Use a @HostListener described here:
https://stackoverflow.com/questions/41304968/how-to-get-on-scroll-events
Examples:
https://plnkr.co/edit/jZEmvMVAJ0XoU0eL6dgp?p=info
https://plnkr.co/edit/5cs8oMraePEos0xEJbh8?p=preview
I used the second one last time I did it.
Don't forgt to import @HostListener:
import { HostListener } from '@angular/core';
@KarolinaCzo
KarolinaCzo / gist:f5da562b36b90f2016088bc76cf5b87b
Created July 25, 2018 07:29
How to make a simple shadow under navbar
Check out this solution:
https://generatepress.com/forums/topic/shadow-under-nav-bar/
https://stackoverflow.com/questions/7591240/what-does-dot-slash-refer-to-in-terms-of-an-html-file-path-location
@KarolinaCzo
KarolinaCzo / gist:8eab700520eb3e925a4c5571839dced6
Created July 25, 2018 09:30
'mailto' protocol / works in Angular 2 (now 6)
https://msdn.microsoft.com/fr-fr/library/aa767737%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
@KarolinaCzo
KarolinaCzo / gist:b9c22a78f97966719ba31dc534a2d051
Created July 26, 2018 08:40
How to remove experimentalDecorators warning in VSCode
The answer can be found here:
https://ihatetomatoes.net/how-to-remove-experimentaldecorators-warning-in-vscode/
@KarolinaCzo
KarolinaCzo / gist:ada3ab4463bfd937c36e533986ff9ab8
Created July 26, 2018 10:36
How to set the background color of only the text (not the whole line) using CSS
Solution:
https://stackoverflow.com/questions/14310154/how-do-i-set-the-background-color-of-targeted-text-only-using-only-css
@KarolinaCzo
KarolinaCzo / gist:537a21760080bae2d9bc8746bd3a8f1e
Created July 27, 2018 10:37
How to create a feature module and add it to the root app module
A great description here:
https://angular.io/guide/feature-modules
@KarolinaCzo
KarolinaCzo / gist:a3ee238796a1cc001eaaff90f9c37df3
Created July 27, 2018 12:41
How to place navbar elements in Bootstrap
https://stackoverflow.com/questions/19733447/bootstrap-navbar-with-left-center-or-right-aligned-items