将数据保存在变量中并将其传递给另一个变量

时间:2017-08-03 18:48:58

标签: javascript variables typescript const

export class ProfilePage {
chartOptions: any;
learningStyleScores: FirebaseListObservable<any>;
constructor(public navCtrl: NavController, public navParams: NavParams, af: AngularFireDatabase) {

    this.learningStyleScores.subscribe(list => {
       var Auditory = list["0"].Audio;
       var Visual = list["0"].Visual;
       var Verbal = list["0"].Verbal;
       var Logical = list["0"].Logical;
       var Solitary = list["0"].Solitary;
       var Social = list["0"].Social;
       var Physical = list["0"].Physical; 
       console.log(list)
      })
    this.chartOptions = {
       .....,
        series: [{
            name: 'Score:',
            data: [
                ['Visual', Visual],
                 ['Auditory', Auditory],
                ['Verbal', Verbal],
                ['Logical', Logical],
                ['Solitary', Solitary],
                ['Social', Social],
                ['Physical', Physical], 
            ]
        }]
    }
}

}

我希望得到每个变量的值并将其传递给其他&#34;这个&#34;并使用其值在图表中显示我的数据。我对如何全局声明变量感到困惑,以便所有人都可以访问它。我究竟做错了什么?

1 个答案:

答案 0 :(得分:0)

进行以下更改:

ReactNode