how to take configration from json for angular every time code example
Example 1: how to compare current date and time with another date and time in android
Date date1 = calendar1.getTime();
Date date2 = calendar2.getTime();
if (date1.compareTo(date2) > 0)
{ Log.i("app", "Date1 is after Date2");}
else if (date1.compareTo(date2) < 0)
{ Log.i("app", "Date1 is before Date2");}
else if (date1.compareTo(date2) == 0)
{ Log.i("app", "Date1 is equal to Date2");}
Example 2: angular add debounce time before putting valu in subject next
import {Component} from '@angular/core';
import {FormControl} from '@angular/forms';
import {Observable} from 'rxjs/Observable';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/throttleTime';
import 'rxjs/add/observable/fromEvent';
@Component({
selector: 'my-app',
template: `<input type=text [value]="firstName" [formControl]="firstNameControl">
<br>{{firstName}}`
})
export class AppComponent {
firstName = 'Name';
firstNameControl = new FormControl();
formCtrlSub: Subscription;
resizeSub: Subscription;
ngOnInit() {
this.formCtrlSub = this.firstNameControl.valueChanges
.debounceTime(1000)
.subscribe(newValue => this.firstName = newValue);
this.resizeSub = Observable.fromEvent(window, 'resize')
.throttleTime(200)
.subscribe(e => {
console.log('resize event', e);
this.firstName += '*';
});
}
ngDoCheck() { console.log('change detection'); }
ngOnDestroy() {
this.formCtrlSub.unsubscribe();
this.resizeSub .unsubscribe();
}
}