简体   繁体   中英

how to add external json values in ionic2

I have a json data in one js file.in IONIC2 i need to get that value from that file and assign to an another variable in constructor..? how to achieve this

export class RangenavigatorDefaultPage {
  rangeData: any;
  constructor(private nav: NavController,) {
     rangeData = //need to add that json variable from external js
   }

}

export the json data from the file. import the json into this file.

FILE 1:

export settings = {
  a: 1,
  b: 2
};

FILE 2:

import { settings } from './file1';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM