UNPKG

consumerportal

Version:

mydna Custimised for you

63 lines (52 loc) 1.96 kB
/// <reference path="../includes.ts" /> module dashboardCtrl { import IUser = services.IUser; import NavigationCard = services.ReportNavigationCard; import ReportNavigationCard = services.ReportNavigationCard; interface IDashboardController { } class DashboardController implements IDashboardController { static $inject = [ '$scope', '$sce', 'apiSrvc', '$location', 'patientService', 'mydnaValues' ]; user: IUser; feedinfo: any = {}; feeds: any[] = []; reports: ReportNavigationCard[] = []; constructor( private $scope: angular.IScope, public $sce: angular.ISCEService, private apiSrvc: apiSrvc.IApiService, private $location: angular.ILocationService, private patientService: services.IPatientService, private mydnaValues: ImyDNAValues, ) { this.getNews(); this.patientService.getReportNavigation().then((reports: ReportNavigationCard[]) => { this.reports = reports; }); } private getNews() { this.apiSrvc.get_request_params_otherResource(this.mydnaValues.feedUrl, '').then(data => { let x2js = new X2JS(); let aftCnv = x2js.xml_str2json(data); if (aftCnv != '' && aftCnv != null && aftCnv != 'undefined') { this.feedinfo = aftCnv.rss.channel; this.feeds = aftCnv.rss.channel.item; } }, (err: any) => { }); } openUrl(url: string, newWindow: boolean = false) { window.open(url, newWindow ? "_blank" : "_self"); } } angular .module('app') .controller('dashboardCtrl', DashboardController); }