Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ng-attr cannot add attributes that end in "-start" #6574

Closed
mattiash opened this issue Mar 6, 2014 · 4 comments
Closed

ng-attr cannot add attributes that end in "-start" #6574

mattiash opened this issue Mar 6, 2014 · 4 comments

Comments

@mattiash
Copy link
Contributor

mattiash commented Mar 6, 2014

I am generating svg from one of my directives. I need to add marker-start and marker-end attributes using ng-attr.

The following snippet works fine:

  <path ng-attr-marker-end="{{line.markerEnd}}">...</path>

It generates a marker-end attribute as expected.

However, the following snippet does not work:

  <path ng-attr-marker-start="{{line.markerStart}}">...</path>

It does not generate a marker-start attribute, but generates a marker attribute instead.

The same behaviour can be observed in the following snippet:

http://jsfiddle.net/t49Xa/2/

I discovered the bug in Angular 1.2.14 and I have also reproduced it in Angular 1.2.1. The bug exists both with Chrome 33.0.1750.146 and Firefox 27.0.1.

@caitp
Copy link
Contributor

caitp commented Mar 6, 2014

This is a dupe of #5370, of which there is a PR. I'll talk to Igor about how merge-able that is today probably. I'll leave this one open for now though since the other one has been closed

@gsklee
Copy link
Contributor

gsklee commented Mar 6, 2014

If we're not gonna fix this before v1.3, at least throw an error and tell people why their directives won't parse the way they think?

@caitp
Copy link
Contributor

caitp commented Mar 6, 2014

1.3 is like next week pretty much, it's right around the corner

@gsklee
Copy link
Contributor

gsklee commented Mar 6, 2014

That's great news indeed!

@btford btford added this to the 1.3.x milestone Mar 7, 2014
@caitp caitp closed this as completed in e8066c4 Jul 16, 2014
ckknight pushed a commit to ckknight/angular.js that referenced this issue Jul 16, 2014
Directives which expect to make use of the multi-element grouping feature introduced in
1.1.6 (angular@e46100f7) must now add the property multiElement
to their definition object, with a truthy value.

This enables the use of directive attributes ending with the words '-start' and '-end' for
single-element directives.

BREAKING CHANGE: Directives which previously depended on the implicit grouping between
directive-start and directive-end attributes must be refactored in order to see this same behaviour.

Before:

```
<div data-fancy-directive-start>{{start}}</div>
  <p>Grouped content</p>
<div data-fancy-directive-end>{{end}}</div>

.directive('fancyDirective', function() {
  return {
    link: angular.noop
  };
})
```

After:

```
<div data-fancy-directive-start>{{start}}</div>
  <p>Grouped content</p>
<div data-fancy-directive-end>{{end}}</div>

.directive('fancyDirective', function() {
  return {
    multiElement: true, // Explicitly mark as a multi-element directive.
    link: angular.noop
  };
})
```

Closes angular#5372
Closes angular#6574
Closes angular#5370
Closes angular#8044
Closes angular#7336
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.