I have a custom directive that uses a modal dialog ($mdDialog) with a 
submit button to call some services.  All of the code is working, but when 
it gets minified I get the "Unknown provider: aProvider <- a " error 
message.  After trying to find where this could be in the code, I realized 
that we always use the controllerName.$inject(param a, param b, etc...) 
format with function controllerName(param a, param b, etc...), so I didn't 
think it was the common cause for the error.  Not using the array notation. 
 However, when I commented out my new controller directive reference in the 
template, the error went away, so I was convinced that was where the issue 
was.

Here is some similar code for the custom directive:
(function () {
'use strict';

angular
.module('myApp')
.directive('myLogin', myLogin);

function myLogin() {
var myLoginDirective = {
template: '<div align="center"><md-button 
ng-click="openLogin()">Login</md-button></div>',
restrict: 'E',
controller: myLoginCtrl
};
return myLoginDirective;

myLoginCtrl.$inject = ['$scope', '$mdDialog'];
/* @ngInject */
function myLoginCtrl($scope, $mdDialog) {
$scope.openLogin = function () {
$mdDialog.show({
templateUrl: 'components/myLogin/myLogin.html',
controller: myLoginModalCtrl,
bindToController: true,
clickOutsideToClose: true
});
}
}
myLoginModalCtrl.$inject = [''$scope', '$window', '$mdDialog', 
'myLoginService''];
function myLoginModalCtrl($scope, $window, $mdDialog, myLoginService,) {
               more code here...

Since I was using a directive controller and a controller for the modal, 
having two directives in the controller works, but I'm thinking that this 
could be the cause of the minification error, although I'm guessing.  Is 
this the correct syntax and could it cause a minify error?

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to