As I continue to dive into AngularJS, I've encountered some challenges with scopes in my current project.
Here is my controller and directive setup:
angular.module('myModule', [])
.controller('myController', ['$scope', function($scope) {
$scope.parentVariable = "Test";
}]);
.directive('myDirective', [function(){
return {
restrict:'AEC',
link: function(scope, element, attrs) {
var child = scope.$eval(attrs.myDirective);
}
}
}]);
Now for the HTML snippet:
<div ng-controller="myController"
<div my-directive="parentVariable"></div>
</div>
I am attempting to access the value of parentValue, yet upon running the code, child remains undefined.