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 synax #9

Open
ChaudhryAtif opened this issue Mar 20, 2017 · 4 comments
Open

ControllerAs synax #9

ChaudhryAtif opened this issue Mar 20, 2017 · 4 comments

Comments

@ChaudhryAtif
Copy link

Don't think I saw an option for this in the document, but 'ControllerAs' syntax would be nice to have. This would allow the ability to pass 'this' as scope. Not sure if the following will be helpful:

// controller declaration
var vm = this;
$ngConfirm({
    scope: vm
});
@craftpip
Copy link
Owner

Can you please explain if angular-confirm had an option for controllerAs, how would it look like ?

The example you provided is valid though,
angular-confirm requires a scope, which is vm in this case, will work fine.

@ChaudhryAtif
Copy link
Author

Will something like this work as well:

$ngConfirm({
    controller: ['$filter', function($filter) {
        var vm = this;
        // Controller code here
    }],
    controllerAs: 'vm'
});

@craftpip
Copy link
Owner

Do you know any other plugin that does this?

Currently angular-confirm simply takes the template and compiles it with the scope, and returns the scope.
adding the proposed thing will be complicated.

@ChaudhryAtif
Copy link
Author

ChaudhryAtif commented Mar 22, 2017

ngDialog is one plugin that does it

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

No branches or pull requests

2 participants