Использование ng-transclude внутри ng-switch
У меня проблемы с получением ng-transclude для работы в директиве ng-switch-default. Вот мой код:
Директива:
.directive('field', ['$compile', function($complile) {
return {
restrict: 'E',
scope: {
ngModel: '=',
type: '@',
},
transclude: true,
templateUrl: 'partials/formField.html',
replace: true
};
}])
обертоны / formField.html
<div ng-switch on="type">
<input ng-switch-when="text" ng-model="$parent.ngModel" type="text">
<div ng-switch-default>
<div ng-transclude></div>
</div>
</div>
Я называю это так ...
<field type="other" label="My field">
test...
</field>
Который выдает ошибку:
[ngTransclude:orphan] Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found.
Он работает без помех, вне директивы ng-switch, но я не знаю, как заставить это работать. Какие-либо предложения?
РЕДАКТИРОВАТЬ: Вот живой демо:http://plnkr.co/edit/3CEj5OY8uXMag75Xnliq?p=preview