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
<!-- attention, we have the c_highlight class -->
<!-- c_highlight is the selector property value of the directive -->
<p class="c_highlight">
Some text.
</p>
@rajaramtt
rajaramtt / hn.resolver.ts
Last active February 19, 2019 18:44
Route Resolvers in Angular 7
import { Injectable } from '@angular/core';
import { HnService } from './hn.service';
import { Resolve } from '@angular/router';
import { ActivatedRouteSnapshot } from '@angular/router';
@Injectable()
export class HnResolver implements Resolve<any> {
constructor(private hnService: HnService) {}
@rajaramtt
rajaramtt / cold observable vs hot observable.txt
Last active August 31, 2019 17:39
cold observable vs hot observable
Observables
Observables are lazy collections of multiple values over time.
Observables are lazy. Observables are lazy in the sense that they only execute values when something subscribes to it
When the data is produced by the Observable itself, we call it a cold Observable.
When the data is produced outside the Observable, we call it a hot Observable.
Cold Observables
@rajaramtt
rajaramtt / Observable, Subject, BehaviorSubject, ReplaySubject and AsyncSubject .txt
Last active March 31, 2019 20:08
Observable, Subject, BehaviorSubject, ReplaySubject and AsyncSubject
Observable: Subscribe to it to get the values
Subject: Same but you also have control of the values that you want to emit into it (can subscribe to it but also emit)
ReplaySubject:
Same as subject but will keep track of the N latest emitted values and every time you subscribe to it,
it'll emit those N values
BehaviorSubject:
Subject where you have to set a default value,
if you subscribe to it before anything has been emitted you'll get the default value
@rajaramtt
rajaramtt / RxJS Operators.txt
Created March 31, 2019 20:15
RxJS Operators
Combination Operators
---------------------------------
combineAll
combineLatest :star:
concat :star:
concatAll
forkJoin
merge :star:
mergeAll
pairwise
@rajaramtt
rajaramtt / ElementRef, TemplateRef, ViewRef, ComponentRef and ViewContainerRef.ts
Last active October 22, 2023 17:26
ElementRef, TemplateRef, ViewRef, ComponentRef and ViewContainerRef
//--------------- ElementRef----------------------
@ViewChild('foo', {static: false}) foo: ElementRef;
@Component({
selector: 'sample',
template: `
@rajaramtt
rajaramtt / angular.json
Last active September 10, 2019 11:58
Stage environment setup in angular
"configurations": {
"production": { ... },
"staging": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.staging.ts"
}
]
}
@rajaramtt
rajaramtt / angular-configuring.md
Created May 29, 2019 07:16
Configuring application environments

environments ├── environment.staging.ts

angular.json

"configurations": {

"staging": { "fileReplacements": [

@rajaramtt
rajaramtt / object into query string parameters in JavaScript.js
Created June 28, 2019 14:03
object into query string parameters in JavaScript
var params = {
a: 1,
b: 2,
c: 3
};
var queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&');
// or
var queryString = Object.keys(params).map(function(key) {
@rajaramtt
rajaramtt / media-query.css
Created August 9, 2019 11:07 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS