国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Front-end - How to get the name attribute of a custom tag in angular?
阿神
阿神 2017-05-15 16:49:12
0
1
777
<livebit name="" age=""></livebit>

Get the name attribute in the link of the command

阿神
阿神

閉關(guān)修行中......

reply all(1)
大家講道理

You need to write your own directive for this, example:

<livebit name="" age=""></livebit>

 angular.module('MyApp').directive('livebit', [function() {
    return {
        restrict: 'E',  
        link: function (scope, elm, attrs) {
             arrts.name  //就可以拿到 name的值
             attrs.age //同上哦
        };
}]);

// restrict 的取值
     E == element(根據(jù)元素名找 livebit)
     C == class (根據(jù)類名來找 livebit)
     A == attribute (根據(jù)屬性名找 livbit)
     ACE == 能找的都找

So your custom tag can be written in the following ways:
There is this:

restrict = 'E'
<livebit name="" age=""></livebit>

This kind:

    restrict = 'C'
<p class="livebit" name="" age=""></p>

There is also this:

restrict = 'C'
<p name="" age="" livebit></p>

After finding the element, you can do whatever you want with your label through the link callback.
For example

請輸入代碼
  elm.appendChild(xxxxx)
  $(elm).jquery-插件xxx()
  .........
 ...........
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template