0

I am using multitranscldue in angular js.I am having a directive like below.

(function(){

    angular.module("MyDirective",['multi-transclude'])
    .directive("myDirective",function(){
        var MyLink = function(scope,element,attr){
            scope.title = attr.title;
        }
        return{
             restrict : 'EA',
            scope: {title:"="},
             transclude:true,
             templateUrl:"directive.html",
             link: MyLink
        }
    });
}())

The html for directive is like

<div >
    <div>
        <span data-ng-bind="title"></span>
        <div ng-multi-transclude="card-body"></div>
    </div>
</div>

In my main html class, I am using the directive like below.

<my-directive title="asdasdas">
        <div name="card-body">
            {{title}}
            </div>
        </my-directive>

I am getting an error like

Error: Illegal use of ngMultiTransclude. No wrapping controller.

Please help me with this.

The link to plunker is here

1 Answer 1

1

you have to add ng-multi-transclude-controller to your directive's HTML template, as follows:

<div ng-multi-transclude-controller>
    <div>
        <span data-ng-bind="title"></span>
        <div ng-multi-transclude="card-body"></div>
    </div>
</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.