Assign array variable to an array from NavParams


#1

Hi! I’m new to Ionic. Can you please help me with this error I am getting?

Error: Module parse failed: C:\Users\student\Desktop\myIonicProject\myLoginForm\node_modules@ionic\app-scripts\dist\webpack\loader.js!C:\Users\student\Desktop\myIonicProject\myLoginForm\src\pages\sliding-list\sliding-list.ts Unexpected token (22:27)
You may need an appropriate loader to handle this file type.
| this.navCtrl = navCtrl;
| this.navParams = navParams;
| this.players = any[];
| players = navParams.get(‘players’);
| }

In my PlayersPage I have players array and I want to pass the same to sliding-list.ts,

export class PlayersPage {

team: any;
players: any[];

constructor(public navCtrl: NavController, public navParams: NavParams) {
this.team = navParams.get(‘team’);
this.players = [];
//Populate Players
for(let i = 0; i < 10; i++){
this.players.push({
text : 'Player ’ + i,
id : i
});
}
}

connect(players){

this.navCtrl.push(SlidingListPage,{players:players});

}

I want to assign an array variable in SlidingListPage

export class SlidingListPage {

players = any[];

constructor(public navCtrl: NavController, public navParams: NavParams) {
players = navParams.get(‘players’);

}

Your responses will be highly appreciated. Thank you in advance.