This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Commit 74b04c9
authored
fix(ngModel, input): improve handling of built-in named parsers
This commit changes how input elements use the private $$parserName
property on the ngModelController to name parse errors. Until now,
the input types (number, date etc.) would set $$parserName when
the inputs were initialized, which meant that any other parsers on
the ngModelController would also be named after that type. The
effect of that was that the `$error` property and the `ng-invalid-...`
class would always be that of the built-in parser, even if the custom
parser had nothing to do with it.
The new behavior is that the $$parserName is only set if the built-in
parser is invalid i.e. returns `undefined`.
Also, $$parserName has been removed from input[email] and input[url],
as these types do not have a built-in parser anymore.
Closes #14292
Closes #10076
Closes #16347
BREAKING CHANGE:
*Custom* parsers that fail to parse on input types "email", "url", "number", "date", "month",
"time", "datetime-local", "week", do no longer set `ngModelController.$error[inputType]`, and
the `ng-invalid-[inputType]` class. Also, custom parsers on input type "range" do no
longer set `ngModelController.$error.number` and the `ng-invalid-number` class.
Instead, any custom parsers on these inputs set `ngModelController.$error.parse` and
`ng-invalid-parse`. This change was made to make distinguishing errors from built-in parsers
and custom parsers easier.1 parent 2e03aed commit 74b04c9
File tree
4 files changed
+120
-11
lines changed- src/ng/directive
- test/ng/directive
4 files changed
+120
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1429 | 1429 | | |
1430 | 1430 | | |
1431 | 1431 | | |
1432 | | - | |
| 1432 | + | |
1433 | 1433 | | |
1434 | 1434 | | |
1435 | 1435 | | |
1436 | 1436 | | |
1437 | | - | |
1438 | 1437 | | |
1439 | 1438 | | |
1440 | 1439 | | |
| |||
1447 | 1446 | | |
1448 | 1447 | | |
1449 | 1448 | | |
| 1449 | + | |
1450 | 1450 | | |
1451 | 1451 | | |
1452 | 1452 | | |
| |||
1499 | 1499 | | |
1500 | 1500 | | |
1501 | 1501 | | |
1502 | | - | |
| 1502 | + | |
1503 | 1503 | | |
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
1507 | 1507 | | |
1508 | | - | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
1509 | 1514 | | |
1510 | 1515 | | |
1511 | 1516 | | |
1512 | 1517 | | |
1513 | 1518 | | |
1514 | | - | |
1515 | 1519 | | |
1516 | 1520 | | |
1517 | 1521 | | |
| 1522 | + | |
| 1523 | + | |
1518 | 1524 | | |
1519 | 1525 | | |
1520 | 1526 | | |
| |||
1596 | 1602 | | |
1597 | 1603 | | |
1598 | 1604 | | |
1599 | | - | |
| 1605 | + | |
1600 | 1606 | | |
1601 | 1607 | | |
1602 | 1608 | | |
| |||
1643 | 1649 | | |
1644 | 1650 | | |
1645 | 1651 | | |
1646 | | - | |
| 1652 | + | |
1647 | 1653 | | |
1648 | 1654 | | |
1649 | 1655 | | |
| |||
1782 | 1788 | | |
1783 | 1789 | | |
1784 | 1790 | | |
1785 | | - | |
1786 | 1791 | | |
1787 | 1792 | | |
1788 | 1793 | | |
| |||
1795 | 1800 | | |
1796 | 1801 | | |
1797 | 1802 | | |
1798 | | - | |
1799 | 1803 | | |
1800 | 1804 | | |
1801 | 1805 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| |||
607 | 608 | | |
608 | 609 | | |
609 | 610 | | |
610 | | - | |
| 611 | + | |
| 612 | + | |
611 | 613 | | |
612 | 614 | | |
613 | 615 | | |
| |||
619 | 621 | | |
620 | 622 | | |
621 | 623 | | |
| 624 | + | |
622 | 625 | | |
623 | 626 | | |
624 | 627 | | |
| |||
721 | 724 | | |
722 | 725 | | |
723 | 726 | | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
724 | 731 | | |
725 | 732 | | |
726 | 733 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
613 | 644 | | |
614 | 645 | | |
615 | 646 | | |
| |||
2457 | 2488 | | |
2458 | 2489 | | |
2459 | 2490 | | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
2460 | 2558 | | |
2461 | 2559 | | |
2462 | 2560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1378 | 1378 | | |
1379 | 1379 | | |
1380 | 1380 | | |
1381 | | - | |
1382 | 1381 | | |
1383 | 1382 | | |
1384 | 1383 | | |
1385 | 1384 | | |
1386 | 1385 | | |
1387 | 1386 | | |
| 1387 | + | |
1388 | 1388 | | |
1389 | 1389 | | |
1390 | 1390 | | |
| |||
0 commit comments