angular-confirm
angular-confirm copied to clipboard
ControllerAs synax
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
});
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.
Will something like this work as well:
$ngConfirm({
controller: ['$filter', function($filter) {
var vm = this;
// Controller code here
}],
controllerAs: 'vm'
});
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.
ngDialog is one plugin that does it