javascript - Getting Error TypeError: onOk is not a function -


i want create conformation dialog, conform before sending data database, getting typeerror: onok not function, onok() defined confirmservice, please check it.

  app.directive('confirmdialog', function(confirmservice) {       return {           restrict: 'a',           scope: {               eventhandler: '&ngclick'           },           link: function(scope, element, attrs){             element.unbind("click");             element.bind("click", function(e) {               confirmservice.open(attrs.confirm, scope.eventhandler, 'confirm_dialog');             });           }       }   });    app.service('confirmservice', function($modal) {     var service = {};     service.open = function (text, onok, dialog_type) {       var modalinstance = $modal.open({         templateurl: 'templates/dialog.html',         controller: 'confirmctrl',         resolve: {           text: function () {             return text;           }         }       });        modalinstance.result.then(function (selecteditem) {         onok();       }, function () {       });     };         return service;   })    app.controller('confirmctrl', function ($scope, $modalinstance, text) {     $scope.text = text;     $scope.ok = function () {       $modalinstance.close(true);     };      $scope.cancel = function () {       $modalinstance.dismiss('cancel');     };   }); 

you have not shown how using directive, have lot of doubts ever work, ngclick directive, not function, , seem passing onok parameter in service.

scope: {     eventhandler: '&ngclick' }, 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -