javascript - Angular: Place 'modal' element over clicked element -
what i'm trying do: have 2 sibling directives. when click on element in directive 1, causes other show on it, acting picker.
the problem: code looks ugly. doing following in event handler in directive 2:
link: function(scope, el, attrs){ $rootscope.$on('show-thing2', function(event, data){ el[0].setattribute('style', 'left:' + (data.left-6) + 'px; top:' + (data.top-11) + 'px;'); scope.picked=true; }) }
the ask: there better/recommended way this? tried using ng-style in html not work me (something timing far can tell) however, if make work, seems cleaner ugly string concatenation.
disclaimer: i'm relatively new angular. looked on not find better way this.
plunker link: here
thank in advance.
Comments
Post a Comment