Skip to content

Better error reporting for [(ng-model)]="exp" syntax #3662

Closed

Description

@pkozlowski-opensource

This [(ng-model)]="exp" will work while ([ng-model])="exp" will fail silently. We should either throw or allow both forms (not sure if it makes sense).

Related: #3645 (should be done together)

Activity

  1. 0x-r4bbit commented on Aug 17, 2015

    @0x-r4bbit
    Contributor

    For consistency I'd also rather vote for throwing an error instead of allowing both syntaxes.

  2. mhevery commented on Aug 19, 2015

    @mhevery
    Contributor

    We should throw on any attribute which is not valid. I think in this case this gets interpreted as event called [ngModel] so we should have some check which say that event names must be alphanumeric.

  3. mhevery commented on Aug 19, 2015

    @mhevery
    Contributor
  4. pkozlowski-opensource commented on Aug 19, 2015

    @pkozlowski-opensource
    MemberAuthor

    OK, makes sense. I will start introducing event checks as part of the schema support, we could have some basic event name checks for the start.

    Will take care of this one (or can help out if anyone from the community is interested!)

  5. pkozlowski-opensource commented on Aug 20, 2015

    @pkozlowski-opensource
    MemberAuthor

    Hmm, digging into it a bit more it seems like HTML spec are putting very little restrictions on the possible event names.... If I understand correctly there is nothing that would prevent one from creating a custom event named [foo] and in this sense ([foo])="actionExp()" should be valid...

    Another way of looking into it is that with custom directive events one can only declare events that are valid JS field names. So maybe we should be more restrictive here and stick to the lowest-common-denominator

  6. 0x-r4bbit commented on Aug 20, 2015

    @0x-r4bbit
    Contributor

    👍 on creating custom restrictions specific to Angular. I think this shouldn't be a problem since prolly no one would come up defining event names that start with [ or ( anyways..

  7. added 5 commits that reference this issue on Aug 21, 2015
    f5e5359
    9264633
  8. yanivefraim commented on Aug 30, 2015

    @yanivefraim

    @pkozlowski-opensource I would love to get this as my first issue here (:
    But I'll need some help with that, if you can. 10x!

  9. 0x-r4bbit commented on Aug 31, 2015

    @0x-r4bbit
    Contributor

    @yanivefraim maybe you can collaborate with @cironunes. Looks like he started working on this already.

    @pkozlowski-opensource or did you also already start with sth?

  10. yanivefraim commented on Aug 31, 2015

    @yanivefraim

    thanks @PascalPrecht.
    @cironunes,@pkozlowski-opensource - can I help with this one?
    I'm looking to get in and start contributing to this project. Any help "getting in" will be highly appriciated

  11. mhevery commented on Oct 19, 2015

    @mhevery
    Contributor

    dup of #4737

  12. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions