Skip to content

Instantly share code, notes, and snippets.

View rajaramtt's full-sized avatar
🤘
Learning and Sharing

Raja Ram T rajaramtt

🤘
Learning and Sharing
  • Hyderabad, India
View GitHub Profile
@rajaramtt
rajaramtt / CUSTOM_ELEMENTS_SCHEMA vs NO_ERRORS_SCHEMA in Angular8.md
Last active August 11, 2020 15:33
CUSTOM_ELEMENTS_SCHEMA vs NO_ERRORS_SCHEMA in Angular8

Including the CUSTOM_ELEMENTS_SCHEMA in the module allows the use of the web components in the HTML markup without the compiler producing errors

  • Defines a schema that allows an NgModule to contain the following:
    • Non-Angular elements named with dash case (-).
    • Element properties named with dash case (-).
  • Dash case is the naming convention for custom elements.
@rajaramtt
rajaramtt / difference between the HashLocationStrategy and PathLocationStrategy.md
Created August 31, 2019 19:56
Know the difference between the HashLocationStrategy and PathLocationStrategy.

To enable HashLocationStrategy in an Angular application we pass {useHash: true} when we are providing our routes with RouterModule, like so:

TypeScript RouterModule.forRoot(routes, {useHash: true})

http://somedomain.com/page#routing-strategies Taking a look at the app we’ve built so far, if running locally the URLs look something like:

localhost:4040/#/search localhost:4040/#/artist/1234/tracks

@rajaramtt
rajaramtt / Sass.md
Last active May 29, 2021 09:10
Sass (which stands for Syntactically Awesome Style Sheets) is an extension to CSS

Sass (which stands for Syntactically Awesome Style Sheets) is an extension to CSS.

sass is superset of css Sass is syntatic sugar of css It helps in writing CSS quickly.

SASS supports two syntaxes namely SCSS and Indented syntax

  • The SCSS - is an extension of CSS syntax. files use the extension .scss.
public onlineOffline: boolean = navigator.onLine;
constructor(.......)
................
................
ngOnInit() {
window.addEventListener('online', () => {
this.onlineOffline = true;
});
@rajaramtt
rajaramtt / angular imp notes.md
Last active September 12, 2019 18:20
angular imp notes

Angular Preloading Strategy

Preloading in Angular means loading the Lazy loaded Modules in the background asynchronously, while user is interacting with the app. This will help boost up the loading time of the app

const app_routes: Routes = [
import { Directive, HostListener } from '@angular/core';
@Directive({
selector: '[appBlockCopyPaste]'
})
export class BlockCopyPasteDirective {
constructor() { }
@HostListener('paste', ['$event']) blockPaste(e: KeyboardEvent) {
e.preventDefault();
import { Directive, ElementRef, HostListener } from '@angular/core';
@Directive({
selector: '[appFocusfirstInvalidfield]'
})
export class FocusfirstInvalidfieldDirective {
constructor(private el: ElementRef) { }
@HostListener('submit', ['$event'])
import { Directive, Input, ElementRef, HostListener } from '@angular/core';
@Directive({
selector: '[appNumbersOnly]'
})
export class NumbersOnlyDirective {
@Input() fieldMaxLength: number;
constructor(private _el: ElementRef) { }
@HostListener('keypress', ['$event']) onkeypress(event) {
@rajaramtt
rajaramtt / Type Script .md
Last active January 5, 2020 18:55
Type Script

Annotations: TypeScript is statically typed and, therefore, all checks are performed at compile time. As mentioned before Types are annotated using :TypeAnnotation syntax.

Primitive Types

let isDone: boolean = false;