我想通过一个JSON对象到我的应用程序使用ng-init + stringify但它不起作用我得到一个Lexer错误。传递JSON对象到ng-init
Lexer Error: Unexpected nextharacter at columns 8-8 [#] in expression [friends=#{JSON.stringify(friends)}].
的Javascript
var friends = [
{name:'John', phone:'555-1276'},
{name:'Mary', phone:'800-BIG-MARY'},
{name:'Mike', phone:'555-4321'},
{name:'Adam', phone:'555-5678'},
{name:'Julie', phone:'555-8765'},
{name:'Juliette', phone:'555-5678'}
];
</script>
HTML
<div ng-init="friends=#{JSON.stringify(friends)}"></div>