I wanted to use on-drag-start
as an attribute in AngularJS directive, called ngDraggable
.
However, it seems not possible to have that attribute.
The following code is in pure javascript, and I can get on-drag-start
as an attribute.
I think I can get any attribute regardless of attribute name.
<h1 id="tag1" on-drag-start="START" on-drag="DRAG" on-drag-end="END" >Hello Plunker!</h1>
Attributes in pure javasctipt DEMO: http://plnkr.co/edit/6iODSnf56KtwPFpoC7ck?p=preview
However, in the following code in AngularjS, I cannot get onDragStart
as an attribute, but it is possible to get onDragBegin
as an attribute.
<h1 id="tag1" ng-draggable on-drag="DRAG" on-drag-end="END"
on-drag-start="START" on-drag-begin="BEGIN">Hello Plunker!</h1>
Attributes in AngularJS directive DEMO: http://plnkr.co/edit/RxABAHHlxQJSSZz91CYW?p=preview
Of course, I can change my attribute name from on-drag-start
to on-drag-begin
, but I am curious.
My questions are;
- why I cannot use
on-drag-start
as an attribute name?
- what's the reason behind it?
- and, is there any general rule for attribute names?
NOTE: I feel my question is not well formatted. Rewriting is welcomed.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…