Hi @mmacdonnell,
That is because the tm1-default-element is expecting a string / text and not a function. Although the function returns a string, it still has to be pass the value properly into tm1-default-element for it to accept the result.
Normally, a string can be passed by enclosing them within {{ < variable here > }}
. However it is not advisable to do this with functions, which can often lead to lots of $digest cycles being involved.
Going back to your case, where is the source of the value 61023367?
Ideally, you can use a variable instead for which you can update based on an event on your page. So the above will look like:
<tm1-ui-subnm
tm1-instance="dev"
tm1-dimension="Org Unit"
tm1-server-mode="true"
tm1-default-element="{{values.defaultUnit}}"
ng-model="model"
>
</tm1-ui-subnm>
On your source, if it is a dropdown for example, you can add an ng-change in there, and trigger the $tm1Ui.dimensionElement function to update the variable we have used:
<select ... ng-model="values.orgUnitAlias" ng-change="updateDefaultOrgUnit(values.orgUnitAlias)"></select>
And finally, the code that will be called to grab the principal element name:
$scope.updateDefaultOrgUnit = function(orgUnitAlias){
$tm1Ui.dimensionElement('dev', 'Org Unit', orgUnitAlias).then(function(data){
$scope.values.defaultUnit = data[0].Name;
});
};
The above is just an example. If you are using SELECT, an easier alternative is to just use SUBNM with the pure dropdown mode enabled. As the ng-model of the SUBNM should always give you the Principal Name of the selected element.
–
Paul