Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't be injected #116

Open
HamadaRizk opened this issue Feb 1, 2017 · 3 comments
Open

can't be injected #116

HamadaRizk opened this issue Feb 1, 2017 · 3 comments

Comments

@HamadaRizk
Copy link

the service can not be injected in another custom service

@nadouani
Copy link

@HamadaRizk I'm not sure to understand why you cannot inject the service in another one.
I'm using a wrapper around it and it works fine

@HamadaRizk
Copy link
Author

can you send me a demo please @nadouani

@nadouani
Copy link

You can find an example here https://plnkr.co/edit/LJhe1FFj1A3ZRv6RDrwg?p=preview

angular.module('NotificationApp', ['ui-notification'])
  .factory('CustomNotification', ['Notification', function(Notification){
    return {
      success: function(message) {
        Notification.success(message);
      }
    };
  }])
  .controller('MainCtrl', ['Notification', 'CustomNotification', function(Notification, CustomNotification) {
    
    this.showNotification = function() {
      Notification.success('Success notification');
    };
    
    this.showWrappedNotification = function() {
      CustomNotification.success('Custom notification');
    };
    
  }]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants