简体   繁体   English

文本编辑器未显示在使用JavaScript添加更多功能中

[英]Text Editor is not displaying in add more functionality using javascript

I am creating Add More fields functionality in angularjs. 我在angularjs中创建“添加更多字段”功能。 In that, I am implementing "what you see what you get" text editor. 在此,我正在实现“所见即所得”文本编辑器。 The HTML code works. HTML代码有效。 When page loads, page displays the text editor with other input fields but when I add more div by clicking on button, other input field displays but the text editor does not display. 页面加载时,页面会显示带有其他输入字段的文本编辑器,但是当我通过单击按钮添加更多div时,会显示其他输入字段,但不会显示文本编辑器。 Below is my code. 下面是我的代码。

HTML: HTML:

        <script src='http://textangular.com/dist/textAngular-rangy.min.js'></script>
        <script src='http://textangular.com/dist/textAngular-sanitize.min.js'></script>
        <script src='http://textangular.com/dist/textAngular.min.js'></script> 

       <style>
       .ta-editor { min-height: 300px; height: auto; overflow: auto; font-family: inherit;
                    font-size: 100%; } 
       </style>

    <div id="innerDiv">
      <div class="form-group" >
        <input type="text">     
        <div text-angular="text-angular" ng-model="user.description" ta-disabled='disabled'></div>
      </div>
   </div>
   <input type="button" onclick="addMore();" ng-click="addMore(dynamicInput)" value="+ Add Another Goal" class="drag_but" />

javascript JavaScript的

<script>
    function addMore(){               
              var newdiv = document.createElement('div');
              newdiv.innerHTML = '<div id="innerDiv">----Same Content with text editor---'; 
   <script>

app.js: app.js:

angular.module('appName', ['textAngular']);

Use a more angular approach. 使用更具角度的方法。 Use a ng-repeater that loops through the number of inputs you want. 使用ng-repeater循环遍历所需的输入数量。

addMore() should then increment the number of inputs you want addMore()然后应该增加您想要的输入数量

Try this: http://www.bootply.com/tH0v5UGZR7 试试这个: http : //www.bootply.com/tH0v5UGZR7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM