mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Merge pull request #10668 from smfeest/multi_slot_transclude
Add additional $transclude function parameters
This commit is contained in:
@@ -867,6 +867,26 @@ angular.module('docsTabsExample', [])
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('multiSlotTranscludeExample', [])
|
||||
.directive('dropDownMenu', function() {
|
||||
return {
|
||||
transclude: {
|
||||
button: 'button',
|
||||
list: 'ul',
|
||||
},
|
||||
link: function(scope, element, attrs, ctrl, transclude) {
|
||||
// without scope
|
||||
transclude().appendTo(element);
|
||||
transclude(clone => clone.appendTo(element));
|
||||
|
||||
// with scope
|
||||
transclude(scope, clone => clone.appendTo(element));
|
||||
transclude(scope, clone => clone.appendTo(element), element, 'button');
|
||||
transclude(scope, null, element, 'list').addClass('drop-down-list').appendTo(element);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
angular.module('componentExample', [])
|
||||
.component('counter', {
|
||||
require: {'ctrl': '^ctrl'},
|
||||
|
||||
2
angularjs/angular.d.ts
vendored
2
angularjs/angular.d.ts
vendored
@@ -1259,7 +1259,7 @@ declare namespace angular {
|
||||
// This corresponds to $transclude (and also the transclude function passed to link).
|
||||
interface ITranscludeFunction {
|
||||
// If the scope is provided, then the cloneAttachFn must be as well.
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction): JQuery;
|
||||
(scope: IScope, cloneAttachFn: ICloneAttachFunction, futureParentElement?: JQuery, slotName?: string): JQuery;
|
||||
// If one argument is provided, then it's assumed to be the cloneAttachFn.
|
||||
(cloneAttachFn?: ICloneAttachFunction): JQuery;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user