landers.angular
Version:
landers.angular
16 lines • 635 B
JavaScript
;angular.module('Landers.angular')
.directive('includes', ['$compile', function($compile){
return {
restrict : 'A',
link : function($scope, $ele, attrs) {
var includes = attrs['includes'].split('|');
var tpl = '<div ng-include src="$partial(\'{mod}\')"></div>';
var tpls = [];
angular.forEach(includes, function(item){
tpls.push(tpl.replace('{mod}', item));
})
var html = tpls.join('\n');
$ele.children().html($compile(html)($scope));
}
}
}]);