I'm using angular-ui-bootstrap-bower#0.7.0 with angular#1.2.10 and when opening a modal where the controller is an "old fashioned" one, everything works fine.
However, when I have a controller meant to use with the new "controller as syntax" it doesn't work. Does angular-ui-bootstrap modal work with controller as syntax? Does version 0.7 support it? How to do it?
Set
'controllerAs'
property in$uibModal.open()
in your template
You can use the ngController syntax for the "controller" option. For example:
There is a sample plunker
Code from plunker:
script.js
In case you are using CoffeeScript, don't forget to explicitly
return
the controller function.Otherwise, the last line will be returned and you will end up with a not working
controller as
syntax, and incidentally, on this SO page.