| angularjs directive和component命名规则的坑今天才发现angularjs doc中directive有这么一段  
 Normalization Angular normalizes an element's tag and attribute nameto determine which elements match which directives. We typically refer
 to directives by their case-sensitive camelCase normalized name (e.g.
 ngModel). However,since HTML is case-insensitive,we refer to
 directives in the DOM by lower-case forms,typically using
 dash-delimited attributes on DOM elements (e.g. ng-model).
 The normalization process is as follows: Strip x- and data- from the front of the element/attributes. Convertthe :,-,or _-delimited name to camelCase.
 这段其实也讲了html命名转化规则 比如我定义一个component名字为cpuLoad,在模板引用中,我们需要这样引用<cpu-load>。就是将首字母小写,每个名字部分首字母大写的形式转化为通过-来连接小写部分的形式。 命名的时候得注意这个隐含的转化规则,真是个坑 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |