首先html 文件
import {ImagePicker} from 'ionic-native';
设置export class ContactPage {} 里面的默认的headface头像
public user={ username : '', userpassword :'' , headface:'images/2.png' }
uploadImages(){ let options = { maximumImagesCount: 10, }; ImagePicker.getPictures(options).then((results) => { for (var i = 0; i < results.length; i++) { alert('Image URL: ' + results[i]); }}, (err) => { alert('Image ERR: ' + err); });}
注意先要安装imagePicker插件,命令:ionic plugin add cordova-plugin-image-picker
浏览器中看不出效果,要打包
ionic build android 或者cordova build android
后在真机或者模拟器上看