ng-model没有使用<angular-ui-tinymce的<textarea>进行更新

时间:2016-12-01 05:09:43

标签: javascript angularjs tinymce

&lt; p&gt;尝试保存在文本编辑器中输入的内容,但内容未在ng-model中设置,我无法通过  ng-model数据甚至到我的controller.js文件&lt; / p&gt; &lt; p&gt; HTML代码:&lt; / p&gt; &LT;预&GT;&LT;代码&GT; &lt; form method =“post”&gt;     &lt; textarea ui-tinymce ng-model =“tinymceModel”&gt;&lt; / textarea&gt;     &LT; /形式&GT; &LT; /代码&GT;&LT; /预&GT; &lt; p&gt; JS代码:&lt; / p&gt; &LT;预&GT;&LT;代码&GT; XYZ:$ scope.tinymceModel, &LT; /代码&GT;&LT; /预&GT;

1 个答案:

答案 0 :(得分:0)

HTML

<body ng-app="testApp" ng-controller="testController">
  <textarea ng-model="tinymceModel" ng-list="&#10;" ng-trim="false" rows="10"></textarea>
</body>

控制器

testApp.controller('testController', function ($scope)
{
    $scope.tinymceModel =
    [
      "First String",
      "Second String",
      "Third String"
    ];
});

// Code goes here

var testApp = angular.module('testApp', []);

testApp.controller('testController', function ($scope)
{
    $scope.tinymceModel =
    [
      "First String",
      "Second String",
      "Third String"
    ];
});
<!DOCTYPE html>
<html>

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js" type="text/javascript"></script>
  <script src="script.js"></script>
</head>

<body ng-app="testApp" ng-controller="testController">
  <textarea ng-model="tinymceModel" ng-list="&#10;" ng-trim="false" rows="10"></textarea>
</body>

</html>