Reputation: 101
I want to create simple pop-up dialog in AngularJS using bootstrap-ui's $dialog directive.
I get $dialog undefined, when I try to inject into my controller. Can someone provide hint on "How to properly inject $dialog" into the following design and invoke it to create a pop-up dialog?
Thanks in advance
index.js:
angular.module('myapp', ['myapp.core','myapp.templates','ui.router', 'ui.bootstrap',
'angularChart', 'angularjs-dropdown-multiselect', 'smart-table', 'angularModalService']);
Page Controller:
(function() {
'use strict';
angular.module('myapp').controller('Page3Controller', Page3Controller);
function Page3Controller(
$scope,
$dialog, // undefined
Page3Service,
Utility) {
Upvotes: 0
Views: 952
Reputation: 3411
As the accepted answer of this post says,
The $dialog
service was refactored into $modal
for version 0.6.0 of ui-bootstrap
. The functionality from $dialog
should still be available, just through $modal
instead.
inject the $modal
service within your module and it should work. Read the docs
So, to edit your code,
(function() {
'use strict';
angular.module('myapp').controller('Page3Controller', Page3Controller);
function Page3Controller(
$scope,
$modal, // now do with it whatever you want, refer to the docs for detailed change
Page3Service,
Utility) {
Please check if it is working this way.
Upvotes: 1
Reputation: 342
Controller:
(function(){
angular.module("myApp").controller("Page3Controller", ["$scope",
"$dialog", "Page3Service", "Utility", Page3Controller]);
function Page3Controller($scope, $dialog, Page3Service, Utility){
$dialog.whatEverYouNeedToDo();
}
});
Upvotes: 0