title: Bind Ckeditor value to model text in AngularJS and Rails
body: <p>I want to bind CKEditor text to <code>ng-model</code> text. My View:</p>
  <pre class="lang-html prettyprint-override"><code>    &lt;form name=&quot;postForm&quot; method=&quot;POST&quot; ng-submit=&quot;submit()&quot; csrf-tokenized class=&quot;form-horizontal&quot;&gt;
    
  
      &lt;fieldset&gt;
      &lt;legend&gt;Post to: &lt;/legend&gt;
      &lt;div class=&quot;control-group&quot;&gt;
        &lt;label class=&quot;control-label&quot;&gt;Text input&lt;/label&gt;
        &lt;div class=&quot;controls&quot;&gt;
          &lt;div class=&quot;textarea-wrapper&quot;&gt;
            &lt;textarea id=&quot;ck_editor&quot; name=&quot;text&quot; ng-model=&quot;text&quot; class=&quot;fullwidth&quot;&gt;&lt;/textarea&gt;
          &lt;/div&gt;
          &lt;p class=&quot;help-block&quot;&gt;Supporting help text&lt;/p&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;form-actions&quot;&gt;
        &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Post&lt;/button&gt;
        &lt;button class=&quot;btn&quot;&gt;Cancel&lt;/button&gt;
        &lt;button class=&quot;btn&quot; onclick=&quot;alert(ckglobal.getDate())&quot;&gt;Cancel123&lt;/button&gt;
      &lt;/div&gt;
    &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  <p>controller</p>
  <pre class="lang-js prettyprint-override"><code>      function PostFormCtrl($scope, $element, $attrs, $transclude, $http, $rootScope) {
        $scope.form = $element.find(&quot;form&quot;);
        $scope.text = &quot;&quot;;
      
        $scope.submit = function() {
            $http.post($scope.url, $scope.form.toJSON()).
            success(function(data, status, headers, config) {
                    $rootScope.$broadcast(&quot;newpost&quot;);
                    $scope.form[0].reset();
                });
        };
      
        $scope.alert1 = function(msg) {
            var sval = $element.find(&quot;ckglobal&quot;);
            //$('.jquery_ckeditor').ckeditor(ckeditor);                                                                                                                      
            alert(sval);
        };
      }
      PostFormCtrl.$inject = [&quot;$scope&quot;, &quot;$element&quot;, &quot;$attrs&quot;, &quot;$transclude&quot;, &quot;$http&quot;, &quot;$rootScope&quot;];
  </code></pre>
  <p>I want to set CKEditor value in <code>$scope.text</code> at the time of form submit.</p>