I must be missing something but I can't figure out why this directive is not showing up, is there anyone to help?
<body ng-controller="MainCtrl">
<p>Test is <b>{{name}}</b> with myValue <b>{{myValue}}</b></p>
<my-new-directive my-test="{{myValue}}"></my-new-directive>
</body>
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
$scope.myValue = true;
});
app.directive('myNewDirective', function() {
return {
restrict: 'E',
replace: true,
link: function(scope, element, attrs) {
attrs.$observe('myTest', function() {
scope.name = attrs.myTest;
if (!attrs.myTest) {
this.template = '<div>FALSE</div>';
} else {
this.template = '<div>TRUE</div>';
}
scope.$apply();
});
}
};
});