Use json pretty print in angularjs

后端 未结 4 1504
梦如初夏
梦如初夏 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:59

    Another option is to turn the function into a filter...

    app.filter('prettify', function () {
    
        function syntaxHighlight(json) {
            // ...
        }
    
        return syntaxHighlight;
    });
    

    HTML...

    
    

    JsFiddle: http://jsfiddle.net/KSTe8/

提交回复
热议问题