从玉传递变量NG-INIT不工作 [英] Passing variable from jade to ng-init not working
问题描述
我想从玉传递一个对象到NG-初始化的角
本:不工作:
NG-的init ='表=!{JSON.stringify(表)}
本:扩展,但
NG-的init ='表=#{JSON.stringify(表)}
输出转义,充满了&放大器; 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.
这篇关于从玉传递变量NG-INIT不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!