Dealing with the frustrating Angular minify issue (fingers crossed it's resolved in Angular 2)
I've gone through and commented out all my app module injections one by one to pinpoint where the problem lies, and it seems like the culprit might be my searchPopoverDirectives:
Can anyone spot what I'm doing incorrectly?
The original code is generating this error:
Unknown provider: eProvider <- e
(function() { "use strict";
var app = angular.module('searchPopoverDirectives', [])
.directive('searchPopover', function() {
return {
templateUrl : "popovers/searchPopover/searchPopover.html",
restrict : "E",
scope : false,
controller : function($scope) {
// Initializing SearchPopover scope:
// -------------------------
var vs = $scope;
vs.searchPopoverDisplay = false;
}
}
})
})();
I attempted using the []
syntax to resolve the minify issue and encountered this error instead: this error:
Unknown provider: $scopeProvider <- $scope <- searchPopoverDirective
(function() { "use strict";
var app = angular.module('searchPopoverDirectives', [])
.directive('searchPopover', ['$scope', function($scope) {
return {
templateUrl : "popovers/searchPopover/searchPopover.html",
restrict : "E",
scope : false,
controller : function($scope) {
// Initializing SearchPopover scope:
// -------------------------
var vs = $scope;
vs.searchPopoverDisplay = false;
}
}
}])
})();
UPDATE: Discovered another problematic area with this directive:
.directive('focusMe', function($timeout, $parse) {
return {
link: function(scope, element, attrs) {
var model = $parse(attrs.focusMe);
scope.$watch(model, function(value) {
if (value === true) {
$timeout(function() {
element[0].focus();
});
}
});
element.bind('blur', function() {
scope.$apply(model.assign(scope, false));
})
}
}
})