Pass parameters with EventEmitter

Source: https://stackoverflow.com/questions/35390765/pass-parameters-with-eventemitter


@Output() stopSort = new EventEmitter();
EventEmitter supports one argument, which is passed as $event to your event handler.
Wrap your parameters in an event object when you pass it to emit:
this.stopSort.emit({ event:event, ui: ui });
Then, when you handle the event, use $event:
stopSort($event) { 
  alert('event param from Component: ' +$event.event);
  alert('ui param from Component: ' + $event.ui);
}

The .subscribe() method accepts 3 callbacks

Source: https://stackoverflow.com/questions/42238819/angular-2-how-to-call-a-function-after-get-a-response-from-subscribe-http-post

// The .subscribe() method accepts 3 callbacks
    .subscribe(
      // The 1st callback handles the data emitted by the observable.
      // In your case, it's the JSON data extracted from the response.
      // That's where you'll find your total property.
      (jsonData) => {
        this.send_categories(jsonData.total);
      },
      // The 2nd callback handles errors.
      (err) => console.error(err),
      // The 3rd callback handles the "complete" event.
      () => console.log("observable complete")
    );

Angular 4 remove required validator conditionally

Source: https://stackoverflow.com/questions/46488078/angular-4-remove-required-validator-conditionally

if you want to add validation try this one.
saveDraft() {
   this.form.get('title').setValidators([Validators.required, Validators.minLength(3)]);
   this.form.get('title').updateValueAndValidity();
}
if you want to remove validators try this one.
saveDraft() {
 this.form.get('title').clearValidators();
 this.form.get('title').updateValueAndValidity();
}

Cold Turkey Blocker

 https://superuser.com/questions/1366153/how-to-get-rid-of-cold-turkey-website-blocker-get-around-the-block Very old question, but still wan...