2017-12-24 24 views
0

안녕 내 코드 AngularJS와에 내가 ckeditor에서 텍스트를 전달하려는 모든하지만 이 항상 정의를 AngularJS와는 HTML바인딩 ckeditor 사이의 데이터 및

<textarea name="editor1" ng-model="editor1" id="editor1" rows="10" cols="80"> 

<button type="submit" class="button expand success" ng-click="insertArticle()">Save</button> 

이며,이 어떻게 여기 AngularJS와

$scope.insertArticle = function(){ 
      $scope.dataInsert = { 
       'editor1':$scope.editor1 
      }; 
$http.post('script_php/insert/insert_article.php',$scope.dataInsert) 
       .success(function(data,status,header,config){ 
        if (status==200) { 
        console.log('GOOD'); 
        console.log($scope.dataInsert); 
        } else { 
        console.log('not good'); 
        } 
       }) 
       } 

질문입니다 내 textarea (CKEDITOR)의 데이터를 바인딩하는 당신은 내가 당신을 이해하고 감사합니다. 이 코드에서 볼 수 있듯이

+0

웹 검색의 솔루션을 찾기가 어렵지 않습니다. https://www.google.com/search?q = angularjs + ckeditor – charlietfl

답변

0

, 바인딩은 실제로 노력하고 있습니다 :

function MyController($scope, $http) { 
 
$scope.insertArticle = function(){ 
 
    alert($scope.editor1); 
 
}; 
 
}
<div ng-app ng-controller="MyController"> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> 
 
<textarea name="editor1" ng-model="editor1" id="editor1" rows="10" cols="80"></textarea> 
 

 
<button type="submit" class="button expand success" ng-click="insertArticle()">Save</button> 
 
</div>

난 당신이 발행한다고 가정한다 오히려 당신이 당신의 포스트의 몸을하지 않는 것이 잘못된 인코딩 때문에 PHP 쪽. 백엔드가 PHP 인 경우 인코딩을 명시 적으로 x-www-form-urlencoded로 설정해야합니다.

$http.post('script_php/insert/insert_article.php',$.param($scope.dataInsert), {headers: {'Content-Type': 'application/x-www-form-urlencoded'}}) 
+0

당신의 도움을 benohead 감사합니다 귀하의 코드를 테스트하고 대답을 –

+0

그것은 아직 정의되지 ?? –