Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = angular.module('app', ['ui.bootstrap']);
- angular.module('app').service('MyService', function() {
- this.doStuff = function(date) {
- console.log(date);
- }
- });
- angular.module('app').config(function($provide) {
- $provide.decorator('datepickerDirective', ['$delegate', 'MyService', function($delegate, MyService) {
- var directive = $delegate[0];
- var link = directive.link;
- directive.compile = function() {
- return function(scope, element, attrs, ctrls) {
- link.apply(this, arguments);
- scope.$watch(function() {
- return ctrls[0].activeDate.getMonth();
- }, function() {
- MyService.doStuff(ctrls[0].activeDate);
- });
- }
- };
- return $delegate;
- }]);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement