When I return scope as function how can I tell that a particullar scope attribute should be taken from element atrribute as string ?
<my-component key="email"></my-component>
I want key to be equal text value supplied in key attribute ("email" in example), I can not use usual scope: {}, so I use function to return scope object.
I tried:
- scope: function(attrs, parentScope, element){
- return new can.Map({
- key: '@',
- })
- },
but it does not work, so I do:
- scope: function(attrs, parentScope, element){
- return new can.Map({
- key: element.getAttribute('key'),
- })
- },
But the problem is that in that case initial value is "email", but also "key" attribute is bind to "email" attribute of parent scope. How can I solve this?