File

src/app/modules/badging/services/content-badge.service.ts

Index

Properties
Methods

Constructor

constructor(config: ConfigService, learner: LearnerService)

constructor

Parameters :
Name Type Optional Description
config ConfigService No

ConfigService reference

learner LearnerService No

LearnerService reference

Methods

Public addBadge
addBadge(req)
Parameters :
Name Optional
req No
Returns : any
Public setAssignBadge
setAssignBadge(badges)
Parameters :
Name Optional
badges No
Returns : void

Properties

badges
Type : EventEmitter<any>
Default value : new EventEmitter()

An event emitter to emit dynamic data passed from a component.

Public config
Type : ConfigService

reference of config service.

Public learner
Type : LearnerService

reference of lerner service.

import { Injectable, EventEmitter } from '@angular/core';
import { ConfigService } from '@sunbird/shared';
import { LearnerService } from '@sunbird/core';
@Injectable()
export class ContentBadgeService {
  /**
   * An event emitter to emit dynamic data passed from a component.
   */
  badges: EventEmitter<any> = new EventEmitter();
  /**
   * reference of config service.
   */
  public config: ConfigService;
    /**
   * reference of lerner service.
   */
  public learner: LearnerService;
  /**
   * constructor
   * @param {ConfigService} config ConfigService reference
   * @param {LearnerService} learner LearnerService reference
   */
  constructor(config: ConfigService, learner: LearnerService) {
    this.config = config;
    this.learner = learner;
  }

  public addBadge(req) {
    const option = {
      url: this.config.urlConFig.URLS.BADGE.CREATE,
      data: { request: req }
    };
    return this.learner.post(option);
  }
  public setAssignBadge(badges) {
    this.badges.emit(badges);
  }
}

results matching ""

    No results matching ""