File

assets/angular/shared/email-service.ts

Description

User related service...

Example

Index

Properties
Methods

Constructor

constructor(http: Http, configService: ConfigService)
Parameters :
Name Type Optional Description
http Http
configService ConfigService

Methods

sendNotification
sendNotification(to: string, template: string, data: any, subject: string, from: string)
Parameters :
Name Type Optional Description
to string
template string
data any
subject string
from string
Returns : Promise<any>

Properties

Protected baseUrl
baseUrl: any
Type : any
Protected config
config: any
Type : any
Protected headers
headers: any
Type : any
import { Injectable, Inject} from '@angular/core';
import { Http, Response, RequestOptions, Headers } from '@angular/http';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import { BaseService } from '../shared/base-service'
import { ConfigService } from '../shared/config-service';
/**
 * User related service...
 *
 * @author <a target='_' href='https://github.com/thomcuddihy'>Thom Cuddihy</a>
 *
 */
@Injectable()
export class EmailNotificationService extends BaseService {
  protected baseUrl: any;
  protected config: any;
  protected headers: any;

  constructor (@Inject(Http) http: Http, @Inject(ConfigService) protected configService: ConfigService) {
    super(http, configService);
  }

  sendNotification(to: string, template: string, data: any = {}, subject: string = null, from: string = null): Promise<any> {
    var payload = {to: to, template: template, data: data};
    if (subject) {
      payload['subject'] = subject;
    }
    if (from) {
      payload['from'] = from;
    }
    return this.http.post(`${this.brandingAndPortalUrl}/api/sendNotification`, payload, this.getOptionsClient())
    .toPromise()
    .then(this.extractData);
  }

}

results matching ""

    No results matching ""