Tm1-ui-subnm - run a function on change


#1

How to run a function when value in tm1-ui-subnm changes?
i.e. I am looking for something like ng-change directive when it’s attached to select tag


#4

Hi @aeremenko,

What is the function supposed to do?


Paul


#5

Just any function attached to $scope in controller.


#6

Hi @aeremenko,

There is no direct way at the moment to fire a function when the value changes. So at the moment, you can use Angular’s $watch function since you are going to write some JS codes already.

We are currently looking into this and will update this topic once we have finalized the changes.

Cheers!


Paul


#7

Example of tm1-ui-subnm in HTML file:

            tm1-instance="dev"
            tm1-dimension="sales measure"
            ng-model="measure"></tm1-ui-subnm>```

To run my function when value of tm1-ui-subnm (measure) changes I put the following code in the controller:

$scope.$watch('measure',function(){
        $scope.myFunction();
});

#8

Hi @aeremenko,

Just to update this topic that we have added an attribute into the subnm directive to help out on this one and will be part of the next build release.

Details should be sent altogether on the release notes.


Paul