mbenford / ngTagsInput

Tags input directive for AngularJS
http://mbenford.github.io/ngTagsInput
MIT License
1.64k stars 541 forks source link

transcludeFn is not defined #42

Closed jeremydstanton closed 10 years ago

jeremydstanton commented 10 years ago

I am using angular 1.2.0 with the latest ng-tags-input build. I thought I cut and pasted the examples directly into my code but I am getting this error when I refresh the page:

TypeError: undefined is not a function at http://localhost:8080/app/vendor/ng-tags-input/ng-tags-input.js:464:9

...which means that in this function...

  tagsInput.directive('transcludeAppend', function() {
      return function(scope, element, attrs, ctrl, transcludeFn) {
          transcludeFn(function(clone) {
              element.append(clone);
          });
      };
  });

...transcludeFn is not defined. My template contains this...

  <tags-input ng-model="tags" placeholder="Add a tag">
    <auto-complete source="loadTags($query)"></auto-complete>
  </tags-input>

...and my controller contains this...

$scope.loadTags = function(query) {
  return $http.get('/tags?query=' + query).then(function(response) {
    return response.data;
  });
};

...please help?

mbenford commented 10 years ago

Hi Jeremy.

The culprit is Angular 1.2.0 (and me, of course, for not having updated the docs properly). There was a bug in that version related to transclusion and the fix involved passing the transcludeFn in the link function (before it was passed in the compile function).

So, you have to upgrade to version 1.2.1 in order to use ngTagsInput. I am truly sorry for having stated in the docs that Angular 1.2+ was supported. I'll fix that right now.

jeremydstanton commented 10 years ago

Ah, so it's 1.2.1 rather than 1.2.0. Excellent!

On Tue, Dec 10, 2013 at 10:05 PM, Michael Benford notifications@github.comwrote:

Hi Jeremy.

The culprit is Angular 1.2.0 (and me, of course, for not having updated the docs properly). There was a bughttps://github.com/angular/angular.js/issues/4935in that version related to transclusion and the fixhttps://github.com/angular/angular.js/commit/90f87072e83234ae366cfeb3c281503c31dad738involved passing the transcludeFn in the link function (before it was passed in the compile function).

So, you have to upgrade to version 1.2.1 in order to use ngTagsInput. I am truly sorry for having stated in the docs that Angular 1.2+ was supported. I'll fix that right now.

— Reply to this email directly or view it on GitHubhttps://github.com/mbenford/ngTagsInput/issues/42#issuecomment-30290297 .

artem-galas commented 10 years ago

very thank you