Created
February 16, 2013 20:13
-
-
Save emaxerrno/4968537 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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