【发布时间】:2015-03-29 05:01:33
【问题描述】:
我想给这样的元素添加一个子元素:
myLayout.root.contentItems[ 0 ].addChild( newItemConfig );
但是来自一个孩子(意思是来自一个 iframe):
parent.myLayout.root.contentItems[ 0 ].addChild( newItemConfig );
当我调用“addChild”时,我得到一个未定义的函数。我该怎么做?
顺便说一句,我正在尝试从 iframe 执行此操作(https://golden-layout.com/examples/#cdcb9de8e7b305d2ec81b4ae4e392832,查看 JS 代码)
PS 我的 webapp 使用 angularjs
【问题讨论】:
-
iframe 的 URL 是否与父级不同?
-
数组 parent.myLayout.root.contentItems 不是空的吗?如果不是,它有什么(对象类型)?
-
@GrzegorzKaczan no...它有很多东西(对象、字符串等...)
-
@Rliger 相同的 URL 但似乎问题是因为我从 iframe 调用...
标签: javascript angularjs addchild