tengo un array con nombres de jugadores, simples strings y no se como puedo pasarlo a la siguiente página
aquí relleno el array desde el myform:
public Players: Array<string> = new Array();
constructor(private formBuilder: FormBuilder){
this.myForm = formBuilder.group({
player1: ['', Validators.required]
});
}
addControl(){
this.Players.push(this.myForm.controls['player'+this.playerCount].value);
console.log(this.Players);
this.playerCount++;
this.myForm.addControl('player' + this.playerCount, new FormControl('', Validators.required));
}
este es el service:
import { Injectable } from "@angular/core";
import { IPlayers } from "../interfaces";
@Injectable()
export class PlayersService {
Players: IPlayers [
]
getPlayers(): IPlayers[]{
return this.Players;
}
}
y esta es la otra pagina donde quiero que llegue el array, pero no llega
export class VerdadORetoPage implements OnInit {
players: IPlayers[];
constructor(private _activatedRoute: ActivatedRoute, private _PlayersService: PlayersService) { }
ngOnInit() {
this.players=this._PlayersService.getPlayers();
console.log(this.players);
}
}
es una pregunta un poco burra pero estoy aprendiendo ionic, no me juzgen jeje, gracias de antemano