从玉传递变量NG-INIT不工作变量、工作、NG、INIT

由网友(人间风雪客)分享简介:我想从玉传递一个对象到NG-初始化的角本:不工作: NG-的init ='表=!{JSON.stringify(表)} 本:扩展,但 NG-的init ='表=#{JSON.stringify(表)} 输出转义,充满了&放大器; QUOT; 取值 NG-的init =表= {&放大器; QUOT; 12安培; Q...

我想从玉传递一个对象到NG-初始化的角

本:不工作:

  NG-的init ='表=!{JSON.stringify(表)} 

本:扩展,但

  NG-的init ='表=#{JSON.stringify(表)} 
如何用RNN生成莎士比亚风格的句子 文末赠书

输出转义,充满了&放大器; QUOT; 取值

  NG-的init =表= {&放大器; QUOT; 12安培; QUOT;:{&放大器; QUOT; ID&安培; QUOT;:.... 

和视图不会更新任何一种情况下。 本文意味着第一一个人应该工作,但就像我说的,它甚至不扩大,

  NG-的init ='表=!{JSON.stringify(表)} 

在源$ C ​​$ C显示在HTML源代码完全相同

  NG-的init ='表=!{JSON.stringify(表)} 

解决方案

其实,#{...} 办法似乎很好地工作。结果这可能是路的console.log 打印属性的值,能够干扰你。

  NG-的init =表=#{JSON.stringify(表)} 

看看这个 短演示 。

I'm trying to pass an object from jade to ng-init in angular

This: doesn't work:

ng-init='tables=!{JSON.stringify(tables)}'

This: expands but,

ng-init='tables=#{JSON.stringify(tables)}'

the output is unescaped and filled with "s

ng-init="tables={"12":{"id":....

and the view isn't updated in either of the cases. This article implies that first one should work, but like I said, it doesn't even expand,

ng-init='tables=!{JSON.stringify(tables)}'

in source code shows up exactly the same in the HTML source

ng-init='tables=!{JSON.stringify(tables)}'

解决方案

Actually, the #{...} approach seems to work fine. It is probably the way console.log prints attributes' values that confused you.

ng-init="tables=#{JSON.stringify(tables)}"

Take a look at this short demo.

阅读全文

相关推荐

最新文章