Oops Oops - 26 days ago 9
AngularJS Question

Migrating UI-Bootstrap modal to component based

I'm studying UI-Router and UI-Bootstrap modal and had problem. the cloned one from UI-Bootstrap tutorial works fine, but when migrating to the component based version I got the problem: it does not show the modal window. May any one help to tell what is wrong.

Answer Source

You should refactor function declarations as following:

From var modalDemoCtrl = function($scope, $uibModal, $log, $document)
to function modalDemoCtrl($scope, $uibModal, $log, $document)

and from var ModalInstanceCtrl = function($uibModalInstance)
to function ModalInstanceCtrl()

This way you can reference to the functions from previous code in file.

Also, you shouldn't pass $uibModalInstance to ModalInstanceCtrl.