-
Notifications
You must be signed in to change notification settings - Fork 27.4k
No error when using controllerAs in directive without an isolated scope #12537
Comments
There should probably be an error, that's right. However, what exactly do you mean with "it will fail the entire application"? This simple example works without an issue: http://plnkr.co/edit/FXOQCsD8HI2F3TgpUNnf?p=preview |
I tried to reproduce it in a simple scenario and I can't seem to. My app has many other directives and they just wouldn't render once I had this issue. If I ever find out, I'll update. Thanks |
can you paste your HTML and JS or provide the code in jsfiddle or codepen that cause the problem? |
There is absolutely no problem with using controllerAs without an isolate scope, why would there be? Yes it's possible to pollute scopes if you don't create a new scope for it, but it's certainly not something you can't do if you're careful |
@caitp Then we should probably update the docs: https://code.angularjs.org/snapshot/docs/api/ng/service/$compile#-controlleras- ;) |
Those docs don't say anything about out being only for isolate scopes |
That's right. They do however say you need a new scope, but it also works without a new scope. I'll create a PR to make this clearer. |
Using controllerAs inside a directive without an isolated scope doesn't work - as is intended. Only problem is that there is no error in the console in the case of this scenario. It will just fail the entire application.
The text was updated successfully, but these errors were encountered: