I'm using ant to build/uglyfy my AngularJS and each time I have a controller in a directive, I get an undefined $scope error. Example of code is this:
app.directive('directive1',['$compile', '$http',function($compile, $http) {
return {
restrict: "A",
controller : function($scope) {
var posts = {};
this.addPosts = function($scope, newPosts) {
angular.extend(posts, newPosts);
//$scope.$apply(function() {
$scope.posts = posts;
//});
};
},
link: function (scope, element, attrs) {
scope.posts = {};
}
};
}]);
My question is, how can I define the $scope of the controller to when it is compiled it doesn't come up as undefined?