javascript - what if I want to create directive that match only for custom element && atribute -


let assume want create directive matched element match aminput[type=dropdown] how can that?

i can example:

.directive('aminput',function () {         return {             restrict: "e",             scope: {                 data:'@'             },             compile:function(telement, tattrs){                 if (tattrs.type != 'dropdown') return;                  return  function link ($scope, element, attr, ctrl) {                     var parseresult = parse($scope.data);                 }             }         }     }); 

but if define directive isolate scope am-input[type=checkbox]

.directive('aminput',function () {         return {             restrict: "e",             scope: {                 data2:'@'             },             compile:function(telement, tattrs){                 if (tattrs.type != 'checkbox') return;                  return  function link ($scope, element, attr, ctrl) {                     var parseresult = parse($scope.data2);                 }             }         }     }); 

angular#$compile throw exception 2 directives define isolate scope.

error: [$compile:multidir] multiple directives [aminput, aminput] asking new/isolated scope on: <am-input type="checkbox"></am-input>

directive name should unique (as long match same restrict) in case should merge them one.

(just reference, might help: angular directive name: lower case letters allowed?)


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -