src/lib/wrapper/base-wrapper/base-wrapper.component.ts
OnInit
providers |
NavigationServiceService
EventsService
|
selector | sb-base-wrapper |
styleUrls | ./base-wrapper.component.css |
templateUrl | ./base-wrapper.component.html |
Properties |
Methods |
|
Inputs |
constructor(navigationServiceService: NavigationServiceService, eventService: EventsService, configSvc: ConfigService, discussionService: DiscussionService)
|
|||||||||||||||
Parameters :
|
config | |
Type : IdiscussionConfig
|
|
ngOnInit |
ngOnInit()
|
Returns :
void
|
Protected wrapperEventListener | ||||
wrapperEventListener(data)
|
||||
Parameters :
Returns :
void
|
Protected wrapperInit |
wrapperInit()
|
Returns :
void
|
state |
Type : string
|
import { Component, Input, OnInit } from '@angular/core';
import { EventsService } from '../../events.service';
import { NavigationServiceService } from '../../navigation-service.service';
import { ConfigService } from '../../services/config.service';
import { DiscussionService } from '../../services/discussion.service';
import * as _ from 'lodash'
import { IdiscussionConfig } from '../../models/discussion-config.model';
@Component({
selector: 'sb-base-wrapper',
templateUrl: './base-wrapper.component.html',
styleUrls: ['./base-wrapper.component.css'],
providers: [NavigationServiceService, EventsService]
})
export class BaseWrapperComponent implements OnInit {
@Input() config: IdiscussionConfig
state: string
constructor(private navigationServiceService: NavigationServiceService, private eventService: EventsService, private configSvc: ConfigService, private discussionService: DiscussionService) { }
ngOnInit() {
this.navigationServiceService.initService('wrapperService')
this.configSvc.setConfigFromWidgetBaseClass(this.config)
this.discussionService.userId = _.get(this.config, 'userName')
const rawCategories = _.get(this.config, 'categories')
this.discussionService.forumIds = _.get(rawCategories, 'result')
this.discussionService.initializeUserDetails(this.config.userName)
this.eventService.toggleMenuItem.subscribe((data) => {
this.wrapperEventListener(data)
this.state = data.action
})
this.wrapperInit()
}
protected wrapperInit() { }
protected wrapperEventListener(data) { }
}
<p>base-wrapper works!</p>
./base-wrapper.component.css