How use “transcludeControllers” in angularjs?

喜欢而已 提交于 2019-12-11 12:52:21

问题


I want use the "transcludeControllers" property present as argument of $compile function of angular (at the end of https://docs.angularjs.org/api/ng/service/$compile page ) I've some problem. I made a jsfiddle.

https://jsfiddle.net/qq4gqn6t/5/

$element.append($compile('<son></son>')($scope, undefined, {
    transcludeControllers: {
        dad: this
    }
}));

But it does not seem to work

Work only if I uncomment the 42 row

//templateUrl: 'sonTemplate.html'

Another solution is

https://jsfiddle.net/qq4gqn6t/6/

Have some ideas?

Thanks in advance

来源:https://stackoverflow.com/questions/34849645/how-use-transcludecontrollers-in-angularjs

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