Currently attempting to create my second Angular directive, but encountering a frustrating issue. As a newcomer to Angular, I have been studying and referencing this insightful explanation as well as this helpful tutorial. However, despite my efforts, I am unable to successfully pass a simple string to the directive.
The code for my basic directive is as follows:
uxctModule.directive('postIt', function() {
return {
restrict: 'AE',
replace: 'true',
scope:{
message: "@"
},
template:"<div>Received: {{message}}</div>"
};
});
I am trying to pass a straightforward string to this directive.
This is how I am implementing it in my markup:
<div post-it message='{{postItContent}}'></div>
Where postItComment
is a scope variable originating from its controller:
$scope.postItContent = "THIS IS A STRING DECLARED IN MY CONTROLLER";
What could be causing this issue? Any insights would be greatly appreciated.