Still new in Angular world and I have a categoriesController wrapping a custom directive categories-select like this:
<div ng-controller="categoriesController" ng-init="init()">
<categories-select></categories-select>
</div>
angular.module('app')
.directive('categoriesSelect', [function () {
return {
restrict: "E",
templateUrl: 'categoriesSelectTemplate',
controller: ['$scope', function ($scope) {
console.log($scope)
console.log($scope.categories)
}],
}
}])
The categoriesController has an array of categories.
The strange behavior I get inside the directive is:
So, whenever I try to get the categories array to do something with it, I find that it's empty, but it's -at the same time- populated in the $scope!
I tried also to isolate the directive scope and pass the array object to it, but I got the same strange behavior, but anyway, I want to know why this simple code doesn't work.
