Skip to content

Instantly share code, notes, and snippets.

@emaxerrno
Created February 16, 2013 20:13
Show Gist options
  • Select an option

  • Save emaxerrno/4968537 to your computer and use it in GitHub Desktop.

Select an option

Save emaxerrno/4968537 to your computer and use it in GitHub Desktop.
(function() {
'use strict';
angular.module('myap').directive('popover', function() {
return {
restrict: "AE",
require: "ngModel",
scope: {
popOverId: "@",
header: "@",
btnText: "@",
unsafeHtml: "@",
cb: "&"
},
link: function(scope, elements, attr, ngModel) {
var _this = this;
if (!ngModel) {
return;
}
ngModel.$render = function() {
return elements.html(ngModel.$viewValue || '');
};
elements.bind('blur keyup change', function() {
return scope.$apply((function() {
return ngModel.$setViewValue(elements.html());
}));
});
return console.log(" linking popover directive" + angular.toJson(attr));
},
transclude: false,
templateUrl: "views/directives/popover.html"
};
});
}).call(this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment