Javascript 如何使用从另一个html文档检索的角度信息填充新的html文档?
我有一个非常基本的页面,其中包含一个文本区域,当按下一个按钮时,它接收一堆文本并对其进行解析。然后弹出一个模式,以便用户可以编辑从解析中检索到的任何信息。在该模式下按下Submit后,我希望打开一个新页面,显示提交的信息,该信息来自textarea和模式中的一些textfields,使用angular 那么,我如何创建一个新的html页面,并用通过angular积累的信息填充它,以便用户能够看到发送到服务器的内容呢 Html:Javascript 如何使用从另一个html文档检索的角度信息填充新的html文档?,javascript,jquery,html,angularjs,Javascript,Jquery,Html,Angularjs,我有一个非常基本的页面,其中包含一个文本区域,当按下一个按钮时,它接收一堆文本并对其进行解析。然后弹出一个模式,以便用户可以编辑从解析中检索到的任何信息。在该模式下按下Submit后,我希望打开一个新页面,显示提交的信息,该信息来自textarea和模式中的一些textfields,使用angular 那么,我如何创建一个新的html页面,并用通过angular积累的信息填充它,以便用户能够看到发送到服务器的内容呢 Html: 解析信息 侵犯财产 发件人的电子邮件 发件人姓名 电子邮件日期 应
解析信息
侵犯财产
发件人的电子邮件
发件人姓名
电子邮件日期
应用程序ID
安卓
{{item}}
网间网操作系统
{{item}}
提交
取消
提交
Javascript:
.controller('MainCtrl', function ($scope, $modal, $log) {
$scope.andItems = [];
$scope.iosItems = [];
$scope.property = "";
$scope.email = "";
$scope.filter = function() {
var input = $scope.inputArea;
/* PROPERTY PARSER*/
var property = "";
for(var i = 0; i <= input.length; i++){
if( input.substring(i, i+10) == "behalf of "){
for(var j = i+10; j <= input.length; j++){
if(input.substring(j, j+1) == " "){
break;
}else{
property += input.substring(j, j+1);
}
}
}
}
$scope.property = property;
/* ID PARSER */
//var ret = "Requested apps to be marked as unauthorized: ";
var iosIds = [];
var andIds = [];
for(var i = 0; i <= input.length; i++){
if( input.substring(i, i+4 ) == "/id/"){
var id = "";
var isAndroid = false;
for(var j = i+4; j <= input.length; j++){
if(input.substring(j, j+1) == " " || input.substring(j, j+1) == "\n"){
break;
}
else{
if(input.substring(j, j+1) == "."){
isAndroid = true;
}
id += input.substring(j, j+1);
}
}
if(isAndroid){
andIds.push(id);
}else{
iosIds.push(id);
}
}
}
$scope.andItems = andIds;
$scope.iosItems = iosIds;
$scope.open();
};
$scope.open = function () {
console.log("test");
var modalInstance = $modal.open({
templateUrl: 'modalContent.html',
controller: ModalInstanceCtrl,
windowClass: 'app-modal-window',
resolve: {
property: function () {
return $scope.property;
},
email: function () {
return $scope.email;
},
andItems: function () {
return $scope.andItems;
},
iosItems: function () {
return $scope.iosItems;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
});
var ModalInstanceCtrl = function ($scope, $modalInstance, property, email, iosItems, andItems) {
$scope.property = property;
$scope.email = email;
$scope.andItems = andItems;
$scope.iosItems = iosItems;
$scope.ok = function () {
$modalInstance.close();
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};
.controller('MainCtrl',function($scope、$modal、$log){
$scope.andItems=[];
$scope.iosItems=[];
$scope.property=“”;
$scope.email=“”;
$scope.filter=函数(){
变量输入=$scope.inputrea;
/*属性分析器*/
var属性=”;
对于(var i=0;我知道你做了什么?你能展示你的代码吗?我刚刚添加了它,谢谢。你试过使用localStorage了吗?@Backus我想我已经有点头疼了,因此我发现很难读懂你的代码中的一些含义。但是你可以通过创建一个代码笔@来让它变得更容易。我想这是Ionic项目
.controller('MainCtrl', function ($scope, $modal, $log) {
$scope.andItems = [];
$scope.iosItems = [];
$scope.property = "";
$scope.email = "";
$scope.filter = function() {
var input = $scope.inputArea;
/* PROPERTY PARSER*/
var property = "";
for(var i = 0; i <= input.length; i++){
if( input.substring(i, i+10) == "behalf of "){
for(var j = i+10; j <= input.length; j++){
if(input.substring(j, j+1) == " "){
break;
}else{
property += input.substring(j, j+1);
}
}
}
}
$scope.property = property;
/* ID PARSER */
//var ret = "Requested apps to be marked as unauthorized: ";
var iosIds = [];
var andIds = [];
for(var i = 0; i <= input.length; i++){
if( input.substring(i, i+4 ) == "/id/"){
var id = "";
var isAndroid = false;
for(var j = i+4; j <= input.length; j++){
if(input.substring(j, j+1) == " " || input.substring(j, j+1) == "\n"){
break;
}
else{
if(input.substring(j, j+1) == "."){
isAndroid = true;
}
id += input.substring(j, j+1);
}
}
if(isAndroid){
andIds.push(id);
}else{
iosIds.push(id);
}
}
}
$scope.andItems = andIds;
$scope.iosItems = iosIds;
$scope.open();
};
$scope.open = function () {
console.log("test");
var modalInstance = $modal.open({
templateUrl: 'modalContent.html',
controller: ModalInstanceCtrl,
windowClass: 'app-modal-window',
resolve: {
property: function () {
return $scope.property;
},
email: function () {
return $scope.email;
},
andItems: function () {
return $scope.andItems;
},
iosItems: function () {
return $scope.iosItems;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
});
var ModalInstanceCtrl = function ($scope, $modalInstance, property, email, iosItems, andItems) {
$scope.property = property;
$scope.email = email;
$scope.andItems = andItems;
$scope.iosItems = iosItems;
$scope.ok = function () {
$modalInstance.close();
};
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
};