Custom AngularJS directive including a dash in the name doesn't work

前端 未结 2 1905
后悔当初
后悔当初 2021-01-12 03:38

I\'ve written the following Angular directive that will add the \"required\" attribute to all children:

.directive(\"requireall\", function($compile) {
  ret         


        
2条回答
  •  执念已碎
    2021-01-12 04:05

    Angular converts camelCasing to snake-casing, so your requireall directive needs to be renamed to requireAll, then you can use require-all in your markup (or data-require-all if you want to correctly markup custom tags). Confused me for a while at first.

提交回复
热议问题