app.directive('myAlert', ['config', function(config){ return { templateUrl: config.rootPath+ 'templates/alert.html', scope: { title: "=", message: "=", visible: "=", cb: "=" }, link: function(scope){ scope.dismiss = function(){ scope.visible = false; if(typeof scope.cb === 'function'){ scope.cb(); } }; } } }]); app.directive('myAlert2', ['config', function(config){ return { templateUrl: config.rootPath+ 'templates/alert2.html', scope: { title: "=", message: "=", visible: "=", cb: "=" }, link: function(scope){ scope.dismiss = function(){ scope.visible = false; }; scope.confirm = function(){ scope.visible = false; if(typeof scope.cb === 'function'){ scope.cb(); } } } } }]); app.directive('myAlert3', ['config', function(config){ return { templateUrl: config.rootPath+ 'templates/alert3.html', scope: { title: "=", message: "=", visible: "=", cb: "=", invite: "=" }, link: function(scope){ scope.dismiss = function(){ scope.visible = false; }; scope.confirm = function(){ scope.visible = false; if(typeof scope.cb === 'function'){ scope.cb(); } } } } }]);