bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

$transclude is not a function

Open nikkwong opened this issue 11 years ago • 9 comments

  .directive('modalTransclude', function () {
    return {
      link: function($scope, $element, $attrs, controller, $transclude) {
        $transclude($scope.$parent, function(clone) {
          $element.empty();
          $element.append(clone);
        });
      }
    };
  })

upon trying to open a modal I am getting the TypeError:

TypeError: $transclude is not a function
    at link (http://localhost:3000/static/bootstrap.js:1918:9)
    at nodeLinkFn (http://localhost:3000/static/angular.js:5435:13)
    at compositeLinkFn (http://localhost:3000/static/angular.js:4911:15)
    at nodeLinkFn (http://localhost:3000/static/angular.js:5429:24)
    at compositeLinkFn (http://localhost:3000/static/angular.js:4911:15)
    at nodeLinkFn (http://localhost:3000/static/angular.js:5429:24)
    at http://localhost:3000/static/angular.js:5589:13
    at http://localhost:3000/static/angular.js:6672:11
    at wrappedCallback (http://localhost:3000/static/angular.js:9769:81)
    at wrappedCallback (http://localhost:3000/static/angular.js:9769:81) <div class="modal-content" modal-transclude="">

Anyone know how this could originate? Thanks :-)

nikkwong avatar Apr 17 '15 06:04 nikkwong

plunkr please

karianna avatar Apr 17 '15 09:04 karianna

@nikkwong https://github.com/angular-ui/bootstrap/blob/master/CONTRIBUTING.md#you-think-youve-found-a-bug

rvanbaalen avatar Apr 17 '15 14:04 rvanbaalen

My apologies. ^_^

http://plnkr.co/edit/uIOIOQEnz6528HavV4s5?p=preview

Thanks!

nikkwong avatar Apr 17 '15 15:04 nikkwong

Thanks for the plunker @nikkwong. But I can now conclude that this is a support question rather than a bug in modal.

A word of advise -- get back to the core basics of opening the modal from a controller. When that works, slowly build up your directive again and see when you get the error.

rvanbaalen avatar Apr 17 '15 15:04 rvanbaalen

Hi, sorry don't mean to re-open, but even in the most simple documented use case this error is still being generated.

http://plnkr.co/edit/uIOIOQEnz6528HavV4s5?p=preview

nikkwong avatar Apr 17 '15 17:04 nikkwong

This is not an issue if you use a more recent version of AngularJS:

http://plnkr.co/edit/gBMGMZ2uGD1Ek9HRGJxP?p=preview

In the upcoming 0.13.0 release, AngularJS 1.3 will be the minimum requirement.

rvanbaalen avatar Apr 17 '15 17:04 rvanbaalen

@nikkwong you are using very old AngularJS version, the err goes away if you switch to the latest released 1.2.x: http://plnkr.co/edit/itF3gPyBjQKEJCQFaePX?p=preview

pkozlowski-opensource avatar Apr 17 '15 17:04 pkozlowski-opensource

Tks :-)

nikkwong avatar Apr 17 '15 17:04 nikkwong

Just in case, if you wanna keep using the older AngularJS version and use the latest angular bootstrap, just search for modal-transclude and replace with ng-transclude or better way just override the module in your app.js and change modal-transclude to ng-transclude.

angular.module("template/modal/window.html", []).run(["$templateCache", function($templateCache) { $templateCache.put("template/modal/window.html", "< div tabindex="-1" role="dialog" class="modal fade" ng-class="{in: animate}" ng-style="{'z-index': 1050 + index*10, display: 'block'}" ng-click="close($event)">\n" + " < div class="modal-dialog" ng-class="{'modal-sm': size == 'sm', 'modal-lg': size == 'lg'}">< div class="modal-content" ng-transclude>< /div>< /div>\n" + "< /div>"); }]);

This is a work around, hope this helps :)

johny25 avatar Apr 30 '15 20:04 johny25