如何传递值将Json字符串化为Angular Js?

时间:2017-08-16 23:22:40

标签: javascript angularjs json node.js

<script>
var app = angular.module('myapp',[]);
app.controller('contacts', function ($scope,$http,$log) {

    $http.get('http://localhost:8080/get-data')
        .then(function(response) {
            $scope.myData = function(){
       return angular.fromJson(response.data);   
}

        $log.info(response.data.title);
    });
});
</script>

这是我的代码,用于Angular JS从Nodejs获取值字符串化MongoDB。

[{"_id":"599498fdee5a447417e09e6e","title":"Notice: Undefined index: tx Paypal response API","content":"dssfsd","author":"f","__v":0},{"_id":"5994c1b2cc72e67c229def07","title":"Notice: Undefined index: tx Paypal response API","content":"dssfsd","author":"sdfsdfsfgsd","__v":0}]

如何在AngularJS中为一个表传递此值?

不要在AngularJS中显示任何值

0 个答案:

没有答案