Click here to Skip to main content
15,880,543 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
how can i make my code appear on runtime when deployed ? should i parse it and how do i parse it ? and on the console.log it shows me the array of colors

       getRandomColor(){
        console.log('colorsss')
    // let colors = ['#33FFFD', '#FFD133','#FF7733','#3386FF']; 
    console.log(this.badgesColorSet)
    const badgesColorSet = JSON.parse(localStorage.getItem('badgesColorSet'));
    return this.badgesColorSet[Math.floor(Math.random() * this.badgesColorSet.length)];
     
    
}

 "badgesColorSet": "['#33FFFD', '#FFD133','#FF7733','#3386FF']" //i have added this code in  turnkey-config.json 

<pre>export class MainService {
	primaryColor;
	url ;
	myRoutes: any[]  = [];
	count: number;
	triggererModule = new Subject<any>();
	triggererProgram = new Subject<any>(); 
    badgesColorSet: [];
    

	 constructor(private globalParamsService: GlobalParametersService,
		private http: HttpClient, private store: Store<AppState>,
		private router: Router , private appInitService: AppInitService) {
			
			this.url = this.appInitService.config.urlPath
			this.primaryColor = this.appInitService.config.primaryColor
            this.badgesColorSet = this.appInitService.config.badgesColorSet

	}


What I have tried:

i have tried json parsing and it didnt workout kindly help me
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900