使用URI Intent打开应用程序后,程序化地填写输入并提交AngularJS表单



我有一个Ionic 1+AngularJS应用程序,带有cordova,在Android上运行。

我正在使用这个cordova插件(https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent)当我用另一个应用程序打开它时,可以获得intent.extra。

我的问题是:在应用程序被另一个应用程序打开后,我如何填写输入并通过程序提交ng?

如果我用javascript填充输入,当我手动提交表单时,提交的值是旧的。

window.plugins.intentShim.onIntent(function (intent) {
console.log('Received Intent: ' + JSON.stringify(intent.extras));
if (intent.extras){
document.getElementById('field1').value = intent.extras.field1||"";
document.getElementById('field2').value = intent.extras.field2||"";
document.getElementById('field3').value = intent.extras.field3||"A";
//apply the values on Angular context and submit
}
});

我在angular controller内部使用document.getElementById('field1'(.value来"解决"我的问题,以获取输入内容,而不是使用angular ng模型值。

最新更新