I am currently trying to wrap ng-controller within a directive and access its attributes in the html, but unfortunately, I am facing difficulties with making it work.
Below is an excerpt of my app.js file:
angular.module('myModule', [])
.directive('myDirective', function()
{
transclude: true,
template: '<div ng-controller="MyController as ctrl" ng-transclude></div>'
});
Despite my efforts, I am unable to retrieve any attribute (e.g., message) defined within MyController. The following code snippet on my html page fails to display the message:
<my-directive>
{{ ctrl.message }}
</my-directive>
Could there be something that I am overlooking here?