This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Description
I'm trying to use an element
<comp tplsuffix="{{user.lang}}"></comp>
and in the .component definition use the function form of templateUrl to add the tplsuffix to the end of the template url, thus
bindings: {
"tplsuffix": '='
},
templateUrl: function ($element, $attrs) {
return 'home.html' + $attrs.tplsuffix;
}
My problems are
- I have to literally use the variables
$element and $attrs or the .component blows up. I imagine this means that minifying will kill this functionality, and it seems ['$element', '$attrs', function ... ] notation isn't allowed here.
- When I call $attrs.tplsuffix I get the non-interpolated version of the string
"{{user.lang}}" instead of the value of that variable.
The relevant documentation in rc0 doesn't discuss how to use this nor give a templateUrl function example.
* If `template` is a function, then it is {@link auto.$injector#invoke injected} with
* the following locals:
*
* - `$element` - Current element
* - `$attrs` - Current attributes object for the element
*
...
* If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with
* the following locals:
*
* - `$element` - Current element
* - `$attrs` - Current attributes object for the element
Is this a bug? Or wasn't this function form designed to handle my use case? Or can someone please provide the correct usage if I've just got it wrong? Thanks!