UNPKG

consumerportal

Version:

mydna Custimised for you

64 lines (52 loc) 2 kB
/// <reference path="../../includes.ts" /> module app { import IUserService = services.IUserService; import IUser = services.IUser; class DietGuidelinesController { details: any; selected: any; state: any; public tabOpen: boolean = false; public tabLabel: string; public reportLabel: string; public loaded: boolean = false; public guideline: string = 'eating'; public drinks: string = ''; public navigation: any[]; public tabs = [ {value: 'eating', label: 'Eating'}, {value: 'drinking', label: 'Drinking'}, {value: 'exercise', label: 'Exercise, Sleep and Stress'} ]; static $inject = [ '$scope', '$routeParams', '$sce', 'dietService', 'user' ]; constructor( $scope: angular.IScope, $routeParams: angular.route.IRouteParamsService, public $sce: angular.ISCEService, private dietService: services.IDietService, public user: IUser ) { this.navigation = this.dietService.navigation($routeParams.type); this.reportLabel = this.dietService.getWeightOverride($routeParams.type); $scope.$on('dietMetricsChanged', (ev: any, details: any) => { this.details = details; }); dietService.details($routeParams.type).then((value: any) => { this.details = value; this.drinks = value.gender === 'M' ? '-2' : ''; this.loaded = true; }); $scope.$on('guidelineTabChanged', (ev: any, value: any) => { this.guideline = value.value; this.tabOpen = false; }); } } angular.module('app').controller('dietGuidelinesCtrl', DietGuidelinesController); }