import { PokemonService } from "./pokemon/pokemon.service";
export class AppComponent implements OnInit {
pokemonList;
constructor(private pokemonService: PokemonService) {}
ngOnInit() {
this.pokemonService.list().then((data) => {
this.pokemonList = data;
});
}
}
<ScrollView>
<FlexboxLayout class="container">
<Image *ngFor="let pokemon of pokemonList"
[src]="pokemon.sprite"
></Image>
</FlexboxLayout>
</ScrollView>
.container {
flex-wrap: wrap;
justify-content: space-around;
}
import { TNSTextToSpeech } from "nativescript-texttospeech";
(tap)="onTap($event, pokemon)"
onTap(event, pokemon) {
var TTS = new TNSTextToSpeech();
TTS.speak({
text: pokemon.name
});
}
pitch: 2.0,
speakRate: 0.5
import { TNSFancyAlert } from "nativescript-fancyalert";
"import { TNSPlayer } from \"nativescript-audio\";",
"var explosion = require(\"nativescript-explosionfield\");"
TNSFancyAlert.showWarning("DANGER 🚨", pokemon.name + " is about to blow up", "💥");
"setTimeout(() => {",
" explosion.explode(event.view);",
"}, 2000);"
"this.player = new TNSPlayer();",
"this.player.initFromFile({",
" audioFile: \"~/sounds/boom.mp3\",",
" loop: false",
"});"
player;
this.player.play();