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

Replacing input element in the directive re-attaches the formatters and parsers #2573

Open
@katranci

Description

@katranci

Given that I've got the following HTML template:

    <input ng-model="test" my-directive />

And the directive definition:

    angular.module('myApp', []).
        directive('myDirective', function() {
            return {
                restrict: 'A',
                template: '<input ng-maxlength="3" />',
                replace: true
            }
        });

When I enter more than three characters the input is set as invalid and then set as valid immediately after due to the model value being set to undefined as a result of the first formatter.

Here is a Fiddle that shows the behaviour: http://jsfiddle.net/katranci/G8znC/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions