我希望能做到。
<div ng-include="'templates/control/title.html'" ng-controller="titleCtrl" ng-init="ControlInit('00001')"></div>
<div ng-include="'templates/control/title.html'" ng-controller="titleCtrl" ng-init="ControlInit('00002')"></div>
<div ng-include="'templates/control/title.html'" ng-controller="titleCtrl" ng-init="ControlInit('00003')"></div>
所以,ng-repeat完成了它。
<div ng-repeat="control in Controls" ng-include="'control.ctrlUrl'" ng-controller="control.ctrlName" ng-init="control.ctrlInit + '(' + control.ctrlCode + ')'"></div>
不工作...... 为什么不呢?
请....答案代码......例子......
答案 0 :(得分:0)
您不需要将control.ctrlUrl
放在'
单引号内。试试这个:
<div ng-repeat="control in Controls" ng-include="control.ctrlUrl" ng-controller="control.ctrlName" ng-init="control.ctrlInit + '(' + control.ctrlCode + ')'"></div>