Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 1.06 KB

pr-6869.md

File metadata and controls

15 lines (11 loc) · 1.06 KB

Unofficial rudimentary support for some of the most used directives of AngularJS 1.x (#6869 by @thorn0)

While there are some syntax incompatibilities (one-time bindings and the precedence of |) between the expression languages of the old AngularJS and the new Angular, overall the two languages are compatible enough for legacy and hybrid AngularJS-based projects to be able to benefit from using Prettier. Previously, when Prettier formatted AngularJS templates using the Angular parser, it formatted expressions only in interpolations. Now, some of the most used AngularJS directives are formatted too, namely: ng-if, ng-show, ng-hide, ng-class, ng-style.

<!-- Input -->
<div ng-if="$ctrl .shouldShowWarning&&!$ctrl.loading  ">Warning!</div>

<!-- Output (Prettier stable) -->
<div ng-if="$ctrl .shouldShowWarning&&!$ctrl.loading  ">Warning!</div>

<!-- Output (Prettier master) -->
<div ng-if="$ctrl.shouldShowWarning && !$ctrl.loading">Warning!</div>