angular.fromJson转化字符串为json会有bug,偶发性

        在使用angular.fromJson将字符串转换为JSON中,遇到一个bug,就是会出现对象某些属性undefined的情况,但其实这些属性是有值的,先上结果:

说明:

        1.createCase.js: 496-->console.log(data.disease_info);打印字符原文;

        2.createCase.js: 498-->console.log(angular.fromJson(data.disease_info));打印转换的JSON,发现disease_id属性未能正常转换,目前不知道原因。

        之后,使用了$.parseJSON与angular.fromJson作比较,发现$.parseJSON正常转换,如果遇到该类情况,请使用$.parseJSON对字符串进行转换。

猜你喜欢

转载自wanlic2008.iteye.com/blog/2334399