Passing variable from jade to ng-init not working

寵の児 提交于 2019-12-04 14:58:27

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.

In what use-case you want to pass data directly from Jade to angular? I think you could to this job in controller like this :

$scope.init = function () { // init stuff }

...and in your view :

ng-init = init()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!