简体   繁体   中英

How to display data from mysql into ckeditor field using angularjs php?

I want to display data from mysql into ckeditor field using angularjs, it works. But the only problem is the array also displayed (can refer here)

Array ( [0] => Array ( [qterm] =>This paragraph only.) ) 

here is my coding.

index.html

<textarea name="editor1" class="ckeditor" id="editor1" ng-model="tnc"></textarea>

myApp.js

var app=angular.module('myApp',[]);
app.controller('cntrl', function($scope,$http) {

    function getTerm() {
        $http.get("qterm.php").success(function(data) {
            $scope.tnc = data;
        });
    };
    getTerm();
});

qterm.php

<?php
include('../config.php');
$query="select qterm from configuration";
$data = array();
$rs=$connect->query($query);

while ($result = mysqli_fetch_assoc($rs)) {
    $data[] = $result;
}

print_r($data);
//print json_encode($data);
?>

What should I do? Thanks for reading.

$output = print_r($data, true);
echo $output;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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