Angular - 如何在单个iframe中获取ckeditor的getdata() [英] Angular - how I get getdata() of a ckeditor in a singular iframe

查看:118
本文介绍了Angular - 如何在单个iframe中获取ckeditor的getdata()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此代码中,每个放置在HTML中的帧都会调用另一个包含ckeditor的html。



In this code for each of the inframe's that are placed in the HTML, another html containing the ckeditor is called.

<body ng-app="myApp">
    <form method="post" ng-controller="TinyMceController">
        <iframe id="iframe1" name="iframe1" runat="server" src="demo.html" style="width: 840px; height: 233px" ></iframe>
        <iframe id="iframe2" name="iframe2" runat="server" src="demo.html" style="width: 840px; height: 233px" ></iframe>
        <iframe id="iframe3" name="iframe3" runat="server" src="demo.html" style="width: 840px; height: 233px" ></iframe>
        <iframe id="iframe4" name="iframe4" runat="server" src="demo.html" style="width: 840px; height: 233px" ></iframe>
        <br>        
        <!--<label>Editor a obtener: <input type="text"  runat="server" ng-model="name"></label>-->
        <button ng-click="getContentControl()">Obtener contenido de: "{{name}}"</button>
        <br>
    </form>
</body>



这是ckeditor的代码(demo.html)


This is the code of the ckeditor (demo.html)

<body ng-app="myApp">
    <form method="post" ng-controller="TinyMceController">
        <div> 
            <textarea name="editor1" id="editor1"  ng-model="tinymceModel"></textarea>
        </div>
        <script>
             CKEDITOR.replace('editor1');
        </script>
        <button ng-click="getContent()">Get content</button>        
    </form>
</body>



这是我正在尝试的角度代码


this is the angular code I'm trying

$scope.getContentControl = function () {
    var iFrame = angular.element('#iframe2' + name);
    console.log(iFrame);
    var Element = iFrame.getElementById('editor1');
    console.log(Element);

};



我想知道怎么做角度,我怎么得到一个或每个ckeditor的html(.getData())在每个iframe里面?



我尝试过:



我想知道怎么做角度,如何得到每个iframe内的一个或每个ckeditor的html(.getData())?


what I want to know how to do in angular, how do I get the html (.getData()) of one or each of the ckeditor that are inside each of the iframes?

What I have tried:

what I want to know how to do in angular, how do I get the html (.getData()) of one or each of the ckeditor that are inside each of the iframes?

推荐答案

scope.getContentControl = function(){
var iFrame = angular.element('#iframe2'+ name);
console.log(iFrame);
var Element = iFrame.getElementById('editor1');
console.log(Element);

};
scope.getContentControl = function () { var iFrame = angular.element('#iframe2' + name); console.log(iFrame); var Element = iFrame.getElementById('editor1'); console.log(Element); };



我想知道怎么做角度,我怎么得到一个或每个ckeditor的html(.getData())在每个iframe里面?



我尝试过:



我想知道怎么做角度,如何得到每个iframe内的一个或每个ckeditor的html(.getData())?


what I want to know how to do in angular, how do I get the html (.getData()) of one or each of the ckeditor that are inside each of the iframes?

What I have tried:

what I want to know how to do in angular, how do I get the html (.getData()) of one or each of the ckeditor that are inside each of the iframes?


我解决了您的演示页面包含的页面,如演示页面

I solved your demo page contain page like the demo page
<html>
<head id="Head1" runat="server">
    <title></title>
   
    
        
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>


<script>
    var myApp = angular.module('myApp', []);
    myApp.controller('TinyMceController', function (


范围,


这篇关于Angular - 如何在单个iframe中获取ckeditor的getdata()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆