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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -