Skip to content

Instantly share code, notes, and snippets.

@ravivit9
ravivit9 / app.module.ts
Created December 3, 2021 15:01 — forked from thisiszoaib/app.module.ts
Loader Network Interceptor
@NgModule({
declarations: [AppComponent],
imports: [
BrowserModule
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: NetworkInterceptor,
multi: true
@ravivit9
ravivit9 / angular-cli-node-js-typescript-compatiblity-matrix.csv Angular CLI, Angular, Node.js, and TypeScript compatibility matrix. Based on changelogs, metadata, and hands-on experience.
Angular CLI version Angular version Node.js version TypeScript version
- 2.x 6.0.x or later minor version 2.0.x
1.0.6 4.0.x/4.1.x 6.9.x or later minor version 2.2.x
1.1.3 4.0.x/4.1.x 6.9.x or later minor version 2.3.x
1.2.7 4.0.x/4.1.x 6.9.x or later minor version 2.3.x
1.3.2 4.2.x/4.3.x/4.4.x 6.9.x or later minor version 2.4.x
1.4.10 4.2.x/4.3.x/4.4.x 6.9.x/8.9.x or later minor version 2.4.x
1.5.6 5.0.x/5.1.x 6.9.x/8.9.x or later minor version 2.4.x/2.5.x
1.6.7 5.2.x 6.9.x/8.9.x or later minor version 2.5.x
1.7.4 5.2.x 6.9.x/8.9.x or later minor version 2.5.x
@ravivit9
ravivit9 / config.xml
Created December 31, 2020 07:59 — forked from somq/config.xml
ionic4 sidemenu config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>i4-sidemenu</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi@ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
@ravivit9
ravivit9 / citystategeo.js
Created February 12, 2020 14:24 — forked from danasilver/citystategeo.js
Get only city and state from Google Maps API Reverse Geocoder
if (window.navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
lng = position.coords.longitude,
latlng = new google.maps.LatLng(lat, lng),
geocoder = new google.maps.Geocoder();
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
if (results[1]) {
for (var i = 0; i < results.length; i++) {
@ravivit9
ravivit9 / citystategeo.js
Created February 12, 2020 14:23 — forked from dody87/citystategeo.js
Get only city and state from Google Maps API Reverse Geocoder
_getCityState = function(resp){
var res = '';
if (resp.status == 'OK') {
if (resp.results[1]) {
var city=false,state=false;
for (var i = 0; i < resp.results.length; i++) {
if ((!city || !state) && resp.results[i].types[0] === "locality") {
city = resp.results[i].address_components[0].short_name,
state = resp.results[i].address_components[2].short_name;
res = city + ", " + state;
@ravivit9
ravivit9 / splice-object-array.js
Created February 11, 2020 21:30 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
// source: http://stackoverflow.com/questions/16491758/remove-objects-from-array-by-object-property
// we have an array of objects, we want to remove one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id:37
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
// remove object
apps.splice(removeIndex, 1);

All about forms in Angular

✏️ by Jiyoon Koo


Angular - Form With Multiple Input Field

SOURCE, SOURCE

contact-information.component.html:

<div id="ContactInput" fxLayout="column" [formGroup]="contactForm">
    <mat-form-field appearance="standard" fxFlex color="accent">
        <mat-label>{{'ContactInformation.customer_name_heading' | translate}}</mat-label>
@ravivit9
ravivit9 / geo.js
Created March 19, 2019 15:43 — forked from mkhatib/geo.js
A Javascript utility function to generate number of random Geolocations around a center location and in a defined radius.
/**
* Generates number of random geolocation points given a center and a radius.
* @param {Object} center A JS object with lat and lng attributes.
* @param {number} radius Radius in meters.
* @param {number} count Number of points to generate.
* @return {array} Array of Objects with lat and lng attributes.
*/
function generateRandomPoints(center, radius, count) {
var points = [];
for (var i=0; i<count; i++) {
@ravivit9
ravivit9 / reduce-from-array-for-matching-criteria
Created July 11, 2018 14:48
Search for a string value from an array of items and return those matching array items.
var dataset = [2,2,4,2,6,4,7,8];
var search = 2;
var count = dataset.reduce(function(n, val) {
return n + (val === search);
}, 0);
console.log(count);