boneskull / angular-tags

Pure AngularJS tagging widget with typeahead support courtesy of ui-bootstrap
MIT License
133 stars 31 forks source link

Typeahead options not being respected #16

Open ravinggenius opened 11 years ago

ravinggenius commented 11 years ago

I verified the templateUrl option by manually visiting http://localhost:9000/bower_components/bootstrap/template/typeahead/typeahead-popup.html. I also verified scope.typeaheadOptions in https://github.com/decipherinc/angular-tags/blob/0.2.10/dist/angular-tags-0.2.10.js#L585 is being set correctly. Why isn't angular-tags requesting the right template? Did I configure it wrong?

In my controller:

$scope.document = new Document();
$scope.typeaheadOpts = {
  templateUrl: 'bower_components/bootstrap/template/typeahead/typeahead-popup.html'
};

In my view:

<tags data-options="{addable: true}" typeahead-options="typeaheadOpts" data-model="document.tags"></tags>

In my browser's console (when visiting http://localhost:9000/#/library):

GET http://localhost:9000/template/typeahead/typeahead-popup.html 404 (Not Found) angular.js:9499
Error: Failed to load template: template/typeahead/typeahead-popup.html
    at Error (<anonymous>)
    at http://localhost:9000/bower_components/angular/angular.js:4725:17
    at http://localhost:9000/bower_components/angular/angular.js:9144:11
    at deferred.promise.then.wrappedErrback (http://localhost:9000/bower_components/angular/angular.js:7004:57)
    at http://localhost:9000/bower_components/angular/angular.js:7080:53
    at Object.$get.Scope.$eval (http://localhost:9000/bower_components/angular/angular.js:8218:28)
    at Object.$get.Scope.$digest (http://localhost:9000/bower_components/angular/angular.js:8077:25)
    at Object.ng.config.$provide.decorator.$delegate.__proto__.$digest (<anonymous>:844:31)
    at Object.$get.Scope.$apply (http://localhost:9000/bower_components/angular/angular.js:8304:24)
    at Object.ng.config.$provide.decorator.$delegate.__proto__.$apply (<anonymous>:855:30)
boneskull commented 11 years ago

Will check this out. @ravinggenius Can you assert that the typeahead directive itself works with your templateURL?

ravinggenius commented 11 years ago

I tried using Bootstrap's typeahead directive directly, and the [typeahead-template-url] attribute seems to be ignored. I had to copy the template files from app/bower_components/bootstrap/template to app/template to get it to work.

In my view:

<input type="text" ng-model="state" typeahead="state for state in states" typeahead-template-url="bower_components/bootstrap/template/typeahead/typeahead-popup.html" />
jojoyuji commented 10 years ago

same here