Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS Directives: Are we not supposed to use the suffix "start"?

Is this a bug or is there documentation somewhere that says not to use the suffix "start" in the name of a directive? Only the 'finish' directive works.

HTML:

<html ng-app="myApp">
...
<body>
  <h2>Angular doesn't like the suffix 'start'</h2>
  <div this-is-the-start="abc"></div>
  <div this-is-the-finish="abc"></div>
</body>
...
</html>

JS:

var myApp = angular.module('myApp',[]);

myApp.directive('thisIsTheFinish', function() {
  return {
    restrict: 'A',
    template: 'finish'
  }  
});

myApp.directive('thisIsTheStart', function() {
  return {
    restrict: 'A',
      template: 'start'
  }  
});

Code in action: http://plnkr.co/edit/SrNncw?p=preview

like image 655
Jesse Avatar asked Dec 23 '13 18:12

Jesse


1 Answers

I'm posting this answer so you can mark this question answered.

As @calebboyd pointed out, this was raised as an issue in GitHub and closed when a note about the breaking change was added to the release notes of "1.2.0rc1 spooky-giraffe (2013-08-13)". It's the last point under $compile in Breaking Changes:

  • due to e46100f7, existing directives with name ending with "-start" or "-end" will stop working.

This change was necessary to enable multi-element directives. The best fix is to rename existing directives, so that they don't end with these suffixes.

like image 95
Bernhard Hofmann Avatar answered Sep 21 '22 06:09

Bernhard Hofmann