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

This is normal?? #51

Open
uiktiomasfeliz opened this issue Dec 5, 2015 · 0 comments
Open

This is normal?? #51

uiktiomasfeliz opened this issue Dec 5, 2015 · 0 comments

Comments

@uiktiomasfeliz
Copy link

1
2
3

I use notify as factory.

.factory('Notify', function ($rootScope, notify) {

    function openNotify(notifyMessage, notifyClass) {
      var positions = ['center', 'left', 'right'],
          position = positions[2],
          duration = 10000;
      notifyClass = notifyClass || 'alert-info'; 

      return notify({
            message: notifyMessage,
            classes: notifyClass,
            templateUrl: 'components/notify/notify.html',
            position: position,//not respect right, show left every time
            duration: duration
          });
    }

    // Public API here
    return {

      notifycation: {


       show: function(callback) {
          callback = callback || angular.noop;

          return function() {
            var args = Array.prototype.slice.call(arguments),
                text = args.shift(),
                customClass = args.shift(),
                showNotify;

            showNotify = openNotify(text, customClass);      

            //callback.apply(event, args);//for future
          };
        }
      }
    };
  });

And i call from controller

$scope.showNotify =  Notify.notifycation.show(function(args) {
      console.log(args);//future callback
    });

var _message = 'Hello World',
      _class = 'alert-info';

$scope.showNotify(_message, _class);
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

1 participant