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

Registering component to have an overloaded method that takes object as parameter, similar to directive registration #14579

Closed
vijquick opened this issue May 10, 2016 · 1 comment

Comments

@vijquick
Copy link

vijquick commented May 10, 2016

Would it be possible to create an overloaded method for registering components that takes object as parameter, in the same way as directive, filters, service etc..

Below are the three ways to register a directive and I am referring to the third option.

  1. directive(name: string, directiveFactory: IDirectiveFactory)
  2. directive(name: string, inlineAnnotatedFunction: any[])
  3. directive(object: Object)

With components you can not register using the third option. If that option is available for registering components, then I can register all the components in one call like show in below sample.

e.g.

var AppComponents;
(function (AppComponents) {
            var firstComponent = (function () {
                function firstComponent() {
                    return {
                        template:"",
                        controller: FirstComponentController
                    };
                }
                return firstComponent;
            })();
            AppComponents.firstComponent = firstComponent;
})(AppComponents || (AppComponents = {}));

(function (AppComponents) {
            var secondComponent = (function () {
                function secondComponent() {
                    return {
                        template:"",
                        controller:  SecondComponentController
                    };
                }
                return secondComponent;
            })();
            AppComponents.secondComponent = secondComponent;
})(AppComponents || (AppComponents = {}));
angular.module("app", [])
    .component(AppComponents)

Regards
Vijay

@Narretz
Copy link
Contributor

Narretz commented May 12, 2016

I think it should be possible to do this. Do you want to open PR which implements this?

@Narretz Narretz added this to the Backlog milestone May 12, 2016
@Narretz Narretz closed this as completed in 57a972d Jul 3, 2017
Narretz pushed a commit that referenced this issue Jul 3, 2017
…nents

Register multiple components with single call as it is possible with other module units.

Closes #14579 
Closes #16062
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants