Reputation: 1476
something simple im sure.. ive set up a very simple directive that accepts an isolated scope item
the template simply prints out the name.
.directive('createDirective', function () {
return {
restrict: 'E',
template: '<div>{{name}} - 123</div>',
scope: { name:'&myName'}
}
});
the HTML:-
<create-directive my-name="bob" ></create-directive>
however, its failing to print out 'bob' im failing to see why not?
Upvotes: 1
Views: 410
Reputation: 193261
Scope configuration is incorrect. It should be:
scope: {
name: '@myName'
}
Special character &
is used to setup a function reference to the outer scope function.
Upvotes: 1