Add ng-model-options to recognized AngularJS attributes (#19777)

Co-authored-by: fisker <lionkay@gmail.com>
This commit is contained in:
Mateusz Turczaandfisker authored and GitHub committed 2026-08-15 18:56:25 +08:00
1 parent d753f4563d
commit ca49e13b3e
4 files changed
+97 -1

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
#### Add ng-model-options to recognized AngularJS attributes (#19777 by @xemlock)
<!-- prettier-ignore -->
```html
<!-- Input -->
<input ng-model="$ctrl.name" ng-model-options="{ debounce : 1000 , 'updateOn' : 'blur' }" />
<!-- Prettier stable -->
<input
ng-model="$ctrl.name"
ng-model-options="{ debounce : 1000 , 'updateOn' : 'blur' }"
/>
<!-- Prettier main -->
<input
ng-model="$ctrl.name"
ng-model-options="{ debounce: 1000, updateOn: 'blur' }"
/>
```
+1 -1
View File
@@ -54,7 +54,7 @@ const printers = [
(name.startsWith("[") && name.endsWith("]")) ||
/^bind(?:on)?-/.test(name) ||
// Unofficial rudimentary support for some of the most used directives of AngularJS 1.x
/^ng-(?:if|show|hide|class|style)$/.test(name)
/^ng-(?:if|show|hide|class|style|model-options)$/.test(name)
);
},
print: createAngularPrinter("__ng_binding"),
@@ -3938,6 +3938,82 @@ trailingComma: "none"
================================================================================
`;
exports[`ng-model-options.html - {"bracketSpacing":false} format 1`] = `
====================================options=====================================
bracketSpacing: false
parsers: ["angular"]
printWidth: 80 (default) |
=====================================input======================================
<input ng-model-options=" { debounce : 1000 , 'updateOn' : 'blur' }" />
=====================================output=====================================
<input ng-model-options="{debounce: 1000, updateOn: 'blur'}" />
================================================================================
`;
exports[`ng-model-options.html - {"htmlWhitespaceSensitivity":"ignore"} format 1`] = `
====================================options=====================================
htmlWhitespaceSensitivity: "ignore"
parsers: ["angular"]
printWidth: 80 (default) |
=====================================input======================================
<input ng-model-options=" { debounce : 1000 , 'updateOn' : 'blur' }" />
=====================================output=====================================
<input ng-model-options="{ debounce: 1000, updateOn: 'blur' }" />
================================================================================
`;
exports[`ng-model-options.html - {"printWidth":1} format 1`] = `
====================================options=====================================
parsers: ["angular"]
printWidth: 1
| printWidth: 1
=====================================input======================================
<input ng-model-options=" { debounce : 1000 , 'updateOn' : 'blur' }" />
=====================================output=====================================
<input
ng-model-options="{
debounce: 1000,
updateOn:
'blur',
}"
/>
================================================================================
`;
exports[`ng-model-options.html - {"trailingComma":"es5"} format 1`] = `
====================================options=====================================
parsers: ["angular"]
trailingComma: "es5"
printWidth: 80 (default) |
=====================================input======================================
<input ng-model-options=" { debounce : 1000 , 'updateOn' : 'blur' }" />
=====================================output=====================================
<input ng-model-options="{ debounce: 1000, updateOn: 'blur' }" />
================================================================================
`;
exports[`ng-model-options.html - {"trailingComma":"none"} format 1`] = `
====================================options=====================================
parsers: ["angular"]
trailingComma: "none"
printWidth: 80 (default) |
=====================================input======================================
<input ng-model-options=" { debounce : 1000 , 'updateOn' : 'blur' }" />
=====================================output=====================================
<input ng-model-options="{ debounce: 1000, updateOn: 'blur' }" />
================================================================================
`;
exports[`real-world.component.html - {"bracketSpacing":false} format 1`] = `
====================================options=====================================
bracketSpacing: false
@@ -0,0 +1 @@
<input ng-model-options=" { debounce : 1000 , 'updateOn' : 'blur' }" />