Page MenuHomec4science

branch4-r.component.ts
No OneTemporary

File Metadata

Created
Mon, Feb 24, 23:43

branch4-r.component.ts

import { Component, OnInit, Injectable } from '@angular/core';
import { Router } from '@angular/router';
import * as $ from 'jquery';
import { Hl } from '../hl';
import { Title } from '@angular/platform-browser';
@Component({
selector: 'app-branch4-r',
templateUrl: './branch4-r.component.html',
styleUrls: ['./branch4-r.component.css']
})
@Injectable()
export class Branch4RComponent implements OnInit {
myValue : Number;
firstObj: String;
firstObj_full: String;
firstObj_best: Number;
firstObj_worst: Number;
firstObj_unit: String;
secondObj : String;
secondObj_full : String;
secondObj_best : Number;
secondObj_worst : Number;
secondObj_unit : String;
constructor(private router: Router, private hl: Hl, private title: Title) {
// this.role = globals.role;
}
doSomething(value){
this.myValue = value;
}
next(){
var item = [];
item.push("100");
if (this.myValue != null){
item.push(this.myValue);
}else{
item.push("1");
}
item.push("0");
// Save data to sessionStorage
sessionStorage.setItem('branch4r', JSON.stringify(item));
//
this.router.navigateByUrl('/survey-v1/branch-ul');
}
ngOnInit() {
this.title.setTitle('Survey v1');
// var data = Array.from(sessionStorage.getItem('branch1'));
// console.log(data);
//var storedArray = JSON.parse(sessionStorage.getItem("branch1"));//no brackets
//var i;
//for (i = 0; i < storedArray.length; i++) {
// alert(storedArray[i]);
//}
//console.log(storedArray);
var data = JSON.parse(sessionStorage.getItem('branch4'));
//console.log(data[0]);
if (data[0] == String(this.hl.heirarchyList[8].objName)){
this.firstObj = this.hl.heirarchyList[8].objName;
this.firstObj_full = this.hl.heirarchyList[8].objFull;
this.firstObj_best = this.hl.heirarchyList[8].best;
this.firstObj_worst = this.hl.heirarchyList[8].worst;
this.firstObj_unit = this.hl.heirarchyList[8].unit;
this.secondObj = this.hl.heirarchyList[9].objName;
this.secondObj_full = this.hl.heirarchyList[9].objFull;
this.secondObj_best = this.hl.heirarchyList[9].best;
this.secondObj_worst = this.hl.heirarchyList[9].worst;
this.secondObj_unit = this.hl.heirarchyList[9].unit;
}else{
this.firstObj = this.hl.heirarchyList[9].objName;
this.firstObj_full = this.hl.heirarchyList[9].objFull;
this.firstObj_best = this.hl.heirarchyList[9].best;
this.firstObj_worst = this.hl.heirarchyList[9].worst;
this.firstObj_unit = this.hl.heirarchyList[9].unit;
this.secondObj = this.hl.heirarchyList[8].objName;
this.secondObj_full = this.hl.heirarchyList[8].objFull;
this.secondObj_best = this.hl.heirarchyList[8].best;
this.secondObj_worst = this.hl.heirarchyList[8].worst;
this.secondObj_unit = this.hl.heirarchyList[8].unit;
}
$(function()
{
$('.slider').on('input change', function(){
$(this).next($('.slider_label')).html(this.value);
});
$('.slider_label').each(function(){
var value = $(this).prev().attr('value');
$(this).html(value);
});
})
}
}

Event Timeline