1

I am using Angular UI Bootstrap Datepicker. I want to add behavior to this component. According to this guide, Extending Directives, I proposed some changes to this component. Changes can be view there: GitHub PR #257.

So now, I am trying to require it inside my extension but Angular keep saying he can't find datepicker controller.

I read this thread on SO AngularJS directive controllers requiring parent directive controllers? in which the answer basically shows the same and it seems working, Fiddle.

I looked at the Angular version which is 1.0.3 in the Fiddle and I am using Angular 1.1.5.

Did this change in latest Angular version or am I doing it wrong?


According to the comments, indeed, it still works with AngularJS 1.1.5. And ended finding what was messing up. As I wanted to extend the core functionalities, I wanted to edit the original template so I used the templateUrl and provided a path to a custom template, which worked when stacking the directives but the same when requiring directives mess the things up.

Do you know how I can override original template in this context?

Community
  • 1
  • 1
Adrien
  • 2,088
  • 1
  • 18
  • 35
  • It should work with 1.1.5 too. – holographic-principle Jul 12 '13 at 15:51
  • I was curious about this, so I wired up a [new plunk here](http://plnkr.co/edit/JQH2iS3tgiv84XVFiewe?p=preview). The child-date directive is successfully "require"ing the datepicker directive. I added a `this.foo` into the datepicker directive to test. Working ok. – rGil Jul 12 '13 at 21:49
  • You're both right. It should works for me too. I don't know what I'm doing wrong. I previously succeeded to extend it by [stacking](https://github.com/angular/angular.js/wiki/Understanding-Directives#stacking-directives) them and it works fine. Now, it doesn't work when I change the way to extend the directive… I'll keep searching what's wrong and see how to edit my question. – Adrien Jul 15 '13 at 09:30

0 Answers0