0
私はnativescript用のプラグインイメージピッカーを使用しています。サンプルコードをコピーして、それがどのように動作し、それを自分のコードに適合させるかを確認しました。しかし、コードは動作しません。ボタンをタップすると、デバイスからのスクリーンギャラリーを開くべきだと思われますが、ボタンをタップすると何も起こりません。nativescriptイメージピッカーが動作しません
以下のコードは、私がこれを実装する方法です。
album_list.component.ts
<StackLayout>
<Button text="Pick Multiple Images" (tap)="onSelectMultipleTap()" > </Button>
</StackLayout>
album_list.component.html
import { Component } from '@angular/core';
import { RouterExtensions } from 'nativescript-angular/router';
//image picker
var imagepicker = require("nativescript-imagepicker");
@Component({
selector:'album_list',
moduleId: module.id,
templateUrl: "album_list.component.html",
})
export class AlbumListComponent{
constructor(private routerExt: RouterExtensions){}
ngOnInit() {
}
onSelectMultipleTap() {
console.log('Im in');
function selectImages() {
var context = imagepicker.create({
mode: "multiple"
});
context
.authorize()
.then(function() {
return context.present();
})
.then(function(selection) {
console.log("Selection done:");
selection.forEach(function(selected) {
console.log(" - " + selected.uri);
});
}).catch(function (e) {
console.log(e);
});
}
}
}
私は関数からHTMLでログボタンをタップすると、前記したようonSelectMultipleTap表示されますが、他にはありません。
ありがとうございます!
ありがとうDavecoffin! :)それはまさにこれでした! – Carlos