首页 > 其他 > 详细

KendoUI坑系列之 ng-include 上ng-controller 无法获取控件

时间:2016-06-02 09:44:35      阅读:191      评论:0      收藏:0      [点我收藏+]
A.Html内容如下
<div>
    <div  kendo-grid="testGrid" k-options="testOptions"> </div>
</div>

B.Html内容如下

 <ng-include  id="dashboard-section1" ng-init="init(0)"    data-ng-controller="textCtrl"  src="‘/A.html‘"></ng-include>

Error:
在testCtrl 中是无法使用$scope.textCtrl获取 testGrid ,是因为 ng-inclue会生成一个独立的子scope ,和controller上的scope独立开来   类似于js的原型链。

所以要在 testCtrl上的 $scope访问 A.Html的控件 则需要 像下面这样写


<div>
    <div  kendo-grid="$parent.testGrid" k-options="testOptions"> </div>
</div>

  

KendoUI坑系列之 ng-include 上ng-controller 无法获取控件

原文:http://www.cnblogs.com/Zoes/p/5551873.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!