Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controllerAs error #259

Closed
djindjic opened this issue Jun 19, 2015 · 8 comments
Closed

controllerAs error #259

djindjic opened this issue Jun 19, 2015 · 8 comments
Assignees
Labels

Comments

@djindjic
Copy link

I have some strange behaviour after setting up controllerAs syntax. Here is a console log:

screen shot 2015-06-19 at 10 51 31 am

So I have simple code to try this feature:

...
      ctrl.openDialog = function () {
          ngDialog.open({
            template:   'popupTmpl.html',
            controller: [function() {
              var vm = this;
              vm.name = 'child';
            }],
            controllerAs: 'ctrlChild'
          });
        };
...

maybe you @andrewogburn know what is a problem?

@egor-smirnov egor-smirnov self-assigned this Jun 19, 2015
@egor-smirnov
Copy link
Member

I guess I know what's the issue. That's maybe because of [] inside controller definition. Not able to check it right now.

@djindjic does it work for you in case of following code?

      ctrl.openDialog = function () {
          ngDialog.open({
            template:   'popupTmpl.html',
            controller: function() {
              var vm = this;
              vm.name = 'child';
            },
            controllerAs: 'ctrlChild'
          });
        };

This is not a solution as we should correctly handle extra dependencies injected into controller, but just wanted to clarify that issue is because of [].

@djindjic
Copy link
Author

@egor-smirnov just tried, I've got same issue.

@egor-smirnov
Copy link
Member

@djindjic could you please prepare plunker where I could play with what you have right now?

@djindjic
Copy link
Author

Yes, give me just a little time 👍

@aoggz
Copy link
Contributor

aoggz commented Jun 19, 2015

Thinking through how I implemented it, I think it only supports named
controllers. I don't think it will ever work with an inline controller
definition. I just got to my desk, so I'm looking into it now.

On Fri, Jun 19, 2015, 5:59 AM Aleksandar Djindjic [email protected]
wrote:

Yes, give me just a little time [image: 👍]


Reply to this email directly or view it on GitHub
#259 (comment)
.

@aoggz
Copy link
Contributor

aoggz commented Jun 19, 2015

Just submitted #260 that should resolve this issue. I confirmed it is working with inline controller definition as well as named controllers in a local project I'm working on.

@egor-smirnov
Copy link
Member

@andrewogburn thanks, will check it later.

@djindjic
Copy link
Author

just to confirm that master works with inline controller. thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants