NG-包括onload事件不再在angularjs 1.2.0 RC工作 [英] ng-include onload not working anymore in angularjs 1.2.0 rc

查看:170
本文介绍了NG-包括onload事件不再在angularjs 1.2.0 RC工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我采用了棱角分明的NG-包括像这样的:

I am using angular's ng-include like this :

主HTML:

<span ng-include="'tpl.html'" ng-controller="TplCtrl" onload="loadMe()"></span>

模板tpl.html:

template tpl.html:

<h2>{{ tplMessage }}</h2>

控制器:

$scope.loadMe = function () {
        $scope.tplMessage =  'template';
    }
})

这是在1.2.0 RC 3个工作罚款angularjs 1.1.5但现在不是了。

this was working fine with angularjs 1.1.5 but not anymore in 1.2.0 rc 3

这里是一个plunkr:
http://plnkr.co/edit/zYRevS?p=$p$pview

here is a plunkr : http://plnkr.co/edit/zYRevS?p=preview

任何想法如何使这项工作与1.2.0?

any idea how to make this work with 1.2.0 ?

编辑:
我看到这一点:<一href=\"https://github.com/angular/angular.js/issues/3584#issuecomment-25279350\">https://github.com/angular/angular.js/issues/3584#issuecomment-25279350
但不能在这里找到答案这个问题。

edit: i saw this : https://github.com/angular/angular.js/issues/3584#issuecomment-25279350 but can't find the answer to this problem here.

推荐答案

这似乎与你在相同的标签混合2要做的事情 - 它既有NG-包括和它NG-控制器。把你跨越一个新的内部和NG-控制器移到外面的标签。

It seems to have to do with you mixing 2 things on the same tag - it has both ng-include and ng-controller on it. put your span inside of a new one and move the ng-controller to the outside tag.

他们might'of改变了这些属性的处理顺序。总的来说,我想将它们混合在同一个标​​签是不是一个好主意。

They might'of changed the order in which these attributes are processed. In general I think mixing them on the same tag is not a good idea.

这篇关于NG-包括onload事件不再在angularjs 1.2.0 RC工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆