看到这个jsfiddle:http: //jsfiddle.net/8bENp/66/
如果您查看 JavaScript 控制台,您会看到如下内容:
TypeError: Object NaN has no method 'replace'
at makeHtml (https://raw.github.com/coreyti/showdown/master/compressed/showdown.js:62:705)
at render (http://fiddle.jshell.net/_display/:50:42)
at link (http://fiddle.jshell.net/_display/:54:13)
at k (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:42:321)
at e (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:38:198)
at k (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:42:261)
at e (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:38:198)
at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:37:332
at https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:15:440
at Object.e.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js:85:416) <markdown ng-model="someCode" class="ng-pristine ng-valid"> angular.min.js:60
问题是model.$modelValue
它NaN
的类型甚至不应该是数字。尽管如此,降价呈现。我可以加一张typeof model.$modelValue == 'string'
支票,但我宁愿处理根本原因。任何的想法?