【发布时间】:2017-08-27 12:37:36
【问题描述】:
我正在用 ionic 和 cordova 开发一个混合移动应用程序。在这个应用程序中,我使用 ngCordova InAppBrowse 将 html 页面加载到应用程序中。
控制器代码:
module.controller('MyCtrl', function($cordovaInAppBrowser) {
$scope.name="Rakesh";
var options = {
location: 'yes',
clearcache: 'yes',
toolbar: 'no'
};
$cordovaInAppBrowser.open('mypage.html', '_blank', options)
.then(function(event) {
// success
})
.catch(function(event) {
// error
});
$rootScope.$on('$cordovaInAppBrowser:loadstart', function(e, event){
});
$rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event){
});
$rootScope.$on('$cordovaInAppBrowser:loaderror', function(e, event){
});
$rootScope.$on('$cordovaInAppBrowser:exit', function(e, event){
});
});
HTML 页面 (mypage.html)
<!DOCTYPE html>
<html>
<head>
<title>InAppBrowser - Test Page</title>
</head>
<body>
<form name="sendParam" method="post" action="https://www.example.com/payment">
<input type="text" id="name" name="name" value="" />
<input type="submit" value="enter">
</form >
</body>
</html>
我想要什么?
我想将 MyCtrl 的 $scope.name 值设置或传递给 mypage.html name text field。
【问题讨论】:
标签: javascript html cordova ionic-framework ngcordova