i making modal box using angular bootstrap, follow following posts , plunker example
angularjs modal not showing when templateurl changes
plunker example
http://plnkr.co/edit/p9qsqgmvovt4ydmi7c0j?p=preview
and below code (controller)
.controller('approfiledetailctrl' , function($scope, $detailedprofileinstance , ap, newprofiles){ $scope.hostname = ap.hostname; $scope.ip = ap.ipaddr; }) .controller('apconfctrl', function($scope, $q, serverprocess, printdialog, valuefactory, configlogic, $modal){ $scope.showdetailapinfo = function(ap, size){ var detailedprofileinstance = $modal.open({ templateurl: 'templates/profile_detail_list.html', controller: 'approfiledetailctrl', scope: $scope, size: size, resolve:{ ap:function(){ return ap; }, newprofiles: function(){ return $scope.newtagsdata; }, } }); };
(markup)
<div class="panel-heading" style="padding:4px;"> <h3 class="panel-title">{{ ap.hostname }} (ip: {{ ap.ipaddr }}) <span style="float:right;" class="glyphicon glyphicon-info-sign" ng-click="showdetailapinfo(ap,'lg')" tooltip="{{ prolang.tooltip.currentapinfo }}" ></span>
the above code brings me following error
but when remove "$detailedprofileinstance" approfiledetailctrl controller, works expected, wonder when should inject service in controller?
my thinking is, in $modal service, modal instance defines controller, therefore injecting modal service not allowed. right?
appreciate , clarification
add following code after approfiledetailctrl.it works me.
approfiledetailctrl.$inject = ['$scope', '$detailedprofileinstance'];
or use
.controller('approfiledetailctrl',['$detailedprofileinstance','$scope' , function($scope, $detailedprofileinstance , ap, newprofiles){ $scope.hostname = ap.hostname; $scope.ip = ap.ipaddr; }])