Use json pretty print in angularjs

后端 未结 4 1473
梦如初夏
梦如初夏 2021-01-30 10:32

How can I use this json pretty print [ http://jsfiddle.net/KJQ9K/ ] with angularJS?

Lets assume myJsonValue is

{a:1, \'b\':\'foo\', c:[false,\'false\',n         


        
4条回答
  •  长情又很酷
    2021-01-30 10:58

    A simpler code:

    app.filter('prettyJSON', function () {
        return function(json) { return angular.toJson(json, true); }
    });
    

    Remember to use the

     tag

提交回复
热议问题