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.

Version 1.5.0:restrict 'A' on component() fails silently which might cause a lot of confusion  #13966

Closed

Description

@radek-anuszewski

In early versions of AngularJS 1.5, it was possible to use restrict: 'A' for component() method, and I used it widely in my code. Breaking change came with 1.5.0-rc.1 quantum-fermentation (2016-01-15), where only restrict: 'E' became permitted, but I missed it (I think not only me) because I stayed with one of the previous 1.5.0 versions. Today I updated Angular's files to 1.5.0 final release and components with restrict: 'A' weren't visible and it took me a while to figure out that I have to replace attribute usages to element usages. Maybe, to avoid confusion, it should throw an Error when component() method meets restrict other than 'E'?
Thank you in advance for looking on this post.

Best regards,
Radek.

Activity

  1. petebacondarwin commented on Feb 8, 2016

    @petebacondarwin
    Contributor

    Yes we talked about this recently... I think there might even be a PR somewhere.

  2. added this to the 1.5.1 milestone on Feb 8, 2016
  3. gkalpak commented on Feb 8, 2016

    @gkalpak
    Member

    The only relevant PR that I can think of is #13802 (which does not exactly cover this issue, but unsupported CDO properties in general).

    @petebacondarwin, was #13802 what you had in mind ?

  4. petebacondarwin commented on Feb 8, 2016

    @petebacondarwin
    Contributor

    Oh yes, @gkalpak that was it. Looks like I wasn't keen. :-/

  5. albatrosary commented on Feb 9, 2016

    @albatrosary

    Hello, everyone

    I tried to implement the Component and Component Router of Angular1.5.It is an error in the difference of the value of the restrict for the Component and Component Router.

    ComponentRouter is so as not to accept only 'A'.

    (angular_1_router.js)

    this.controller.$$routeParams = instruction.params;
    this.controller.$$template = '<div ' + dashCase(componentName) + '></div>';
    this.controller.$$router = this.router.childRouter(instruction.componentType);

    But Angular1 Component is 'E'.

    (angular/angular1.js)

          return {
            controller: controller,
            controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',
            template: makeInjectable(template),
            templateUrl: makeInjectable(options.templateUrl),
            transclude: options.transclude,
            scope: {},
            bindToController: options.bindings || {},
            restrict: 'E',
            require: options.require
          };

    When I say that either, I think that is good to the 'E'.

    Thank you.

  6. gkalpak commented on Feb 9, 2016

    @gkalpak
    Member

    @albatrosary, this has been fixed with angular/angular#6796 (the router will create elements, instead of divs). The fix will be included in the next release of the router.

  7. albatrosary commented on Feb 9, 2016

    @albatrosary

    @gkalpak, Great! ,Thank you.

  8. Narretz commented on Feb 15, 2016

    @Narretz
    Contributor

    Since not many people will be affected by the BC from beta to 1.5.0, we'll not gonna log / throw etc. here. Maybe we can do the validation inside the ngHint project, but that's also very low priority: angular/angular-hint#118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions