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

Can you alias the controller to another name? #179

Open
@krimple

Description

@krimple

This is more of a question - the controllerAs syntax lets you rename the controller 'this' instance to something else, and you can do that with ng-controller, but in the router you get an automatic rename to the component name.

I'm not a huge fan of this, as I'd like to use vm as my view model name if I want to, regardless of the component name. That kind of follows what I've seen in Angular 2.0 as a naming convention as well as using controllerAs with John Papa's naming conventions.

For example, I have a galleries use case that lists all galleries, and I'd prefer to have the controller instance name be vm, so I can inject 'galleries' as a model element. such as:

vm.galleries

rather than

galleries.galleries

Any way to do this? I'd like to see it as an 'as' property in the route instructions

Ken

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions