I am currently working on a project involving an Angular directive that is designed to take input data and update a scope variable accordingly. However, I am encountering difficulties in getting it to function as intended.
Below is a simplified version of the JavaScript code I have been using:
var module = angular.module('myapp', []);
module.directive('checkDirective', function() {
return {
restrict: 'E',
scope: { line: '@' },
transclude: true,
controller: function($scope) {
$scope.newLine = $scope.line;
},
template: '<div ng-transclude></div>'
};
});
Furthermore, here is the HTML code associated with this directive:
<div ng-app="myapp">
0
<check-directive line="...">
a{{line}}b{{newLine}}c
</check-directive>
1
</div>
If you wish to see a demonstration, please refer to this fiddle: http://jsfiddle.net/k66Za/60/
Your assistance in resolving this matter would be greatly appreciated.