0
内部控制器我想有多个模板的指令,因为在this SOAngularJS - 与NG-包括绕过指令
当使用一个指令编译为this jsfiddle 的的NG-包括使用编译外部控制器和 和内部控制器不可用的模板的范围
例如
function someDirective(){
return {
scope:{
...
},
compile: function(element, attrs) {
var type = "extended"; //default
if(typeof attrs.type !== 'undefined')
type = attrs.type;
element.append('<div ng-include="\'myproj/views/templates/group/groups-' + type + '.html\'"></div>');
},
//templateUrl: 'myproj/views/templates/group/groups-sideMenu.html',
controller:function($scope, $attrs, $rootScope, UtilsSrvc){
// ... the template won't use this controller
}
}
}
如何解决这一问题问题?
编辑
经过一番headbang东西有更清晰的 In this fiddle(亚历山德罗Cifani)剧本的作品无论是对角1.0,角1.1和角1.2
的问题试图范围隔离时启动: this fiddle只适用于Angular < = 1.1,而Angular> = 1.2不起作用
当一个空的'templateUrl'是adde时d如图this fiddle:它开始是兼容所有版本
???????????????