How to set up attributes in angularjs directive restricted to comments

前端 未结 1 1659
春和景丽
春和景丽 2021-01-11 12:21

I\'ve found nice feature in angularjs. Directives can be set to work on comments.

{
    ...
    restrict: \'M\'
    ...
}

This does the tri

1条回答
  •  春和景丽
    2021-01-11 13:09

    
    

    Where everything after the directive name is the value passed into the directive.

    app.directive('myDirectiveName', function(){
       return {
          restrict: 'M',
          link: function(scope, elem, attr) {
              alert(attr.myDirectiveName); //alerts "this is all an argument"
          }
       };
    });
    

    0 讨论(0)
提交回复
热议问题